API & Developers

API & Developers

Connect with other developers from around the world and collaborate on ideas using the Smartsheet API.

Admin Sharing to workspaces by default

✭✭✭✭✭✭

Good morning!

I'm wondering if anyone has created an automation, either through the API, or some other third party app, to automatically share a system admin to a workspace when it's created?

We're a very large company, Smartsheet use is growing quickly, and we're thinking about how do we ensure that our system admins have access for trouble shooting, or re-assigning ownership when someone leaves or changes roles.

While we can simply ask everyone to do this, we'd prefer to automate it so it's not subject to operator error, or someone simply forgetting.

Thanks for any feedback you may have for me.

Answers

  • ✭✭✭

    In its simplest implementation

    Run a regular CRON job to:

    Find all your workspaces -

            PaginatedResult<Workspace> workspaces = smartsheet.WorkspaceResources.ListWorkspaces(

             null        // PaginationParameters

            );

    Then add a share by passing in the WorkspaceId- i.e for each Workspace in Workspaces

    Share[] shareSpecification = new Share[] { new Share
      {
        Email = "user.email@you.com",
        AccessLevel = AccessLevel.ADMIN
      }
    };
    
    // Share workspace
     IList<Share> addressList = smartsheet.WorkspaceResources.ShareResources.ShareTo(
      999999999999,               // long workspaceId in you foreach
      shareSpecification,
      true                        // Nullable<bool> sendEmail - good confirmation mechanism
    );
    

    Then you can make it a bit slicker by, maybe, keeping a list of ones you have done or just seeing if admin had already been added by looping round the share list.

    Regards,

    Brian

Trending in API & Developers