ShareWorkspace
Shares a workspace with a user or group in your Smartsheet account.
Stored Procedure-Specific Information
Note: The Id output parameter does not contain any values if the workspace has already been shared previously (with the same member).The following rules must be met when executing this procedure; otherwise it fails with an error.
Parameter Groups
When executing this procedure, exactly one group from the following parameter groups must be specified:- Single-share group: Use this group when you want to share the workspace with a single member. It accepts the following parameters:
- UserEmail or GroupId (but not both)
- AccessLevel
- Multi-share group: Use this group when you want to share the workspace with multiple members. It accepts the following parameter:
- MultiShareAggregate
The value provided for the MultiShareAggregate parameter must be an array of JSON objects. The array must contain at least one valid share object. Each share object must include either UserEmail or GroupId (but not both), and an allowed AccessLevel value (see the AccessLevel parameter description in the Input section).
For example:
[
{
"UserEmail": "[email protected]",
"AccessLevel": "VIEWER"
},
{
"GroupId": 123456,
"AccessLevel": "EDITOR"
},
// ...
]
Email Parameters
The following parameters can be used to configure the email that is sent to the members with whom the workspace is shared:- CcMe
- EmailSubject
- EmailMessage
Note: These parameters can be used only when SendEmail is set to True.
Example Queries
For examples on how to use this stored procedure, refer to the following queries:-- Single Share
EXEC ShareWorkspace WorkspaceId = '3947571576786820', UserEmail = '[email protected]', AccessLevel = 'VIEWER';
-- Multi Share
EXEC ShareWorkspace WorkspaceId = '3947571576786820', MultiShareAggregate = '[{"userEmail":"[email protected]", "accessLevel":"VIEWER"}, {"userEmail":"[email protected]", "accessLevel":"EDITOR"}]', SendEmail = true, CcMe = true, EmailSubject = 'Sharing an asset', EmailMessage = 'You can find the shared asset attached to this email.';
Input
| Name | Type | Required | Description |
| WorkspaceId | String | True | The unique identifier of the workspace being shared. |
| UserEmail | String | False | The email of the user to share the workspace with. |
| GroupId | String | False | The unique identifier of the group to share the workspace with. |
| AccessLevel | String | False | The access level for the user or group on the shared workspace.
The allowed values are ADMIN, COMMENTER, EDITOR, EDITOR_SHARE, VIEWER. |
| SendEmail | Boolean | False | Boolean value indicating whether to notify the user or group about the shared workspace with an email. |
| CcMe | Boolean | False | Boolean value indicating whether to send a copy of the email to the sharer of the workspace. |
| EmailSubject | String | False | The subject of the email for the shared workspace. |
| EmailMessage | String | False | The message of the email for the shared workspace. |
| MultiShareAggregate | String | False | A JSON array of share objects, containing the information required for sharing the workspace with multiple members. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | A boolean value indicating whether the operation was successful. Returns 'true' if the workspace was shared successfully, and 'false' otherwise. |
| Id | String | The unique identifiers of the shares that were created in CSV format. |