ShareWorkspace
Shares a workspace with a user or group in your Smartsheet account.
Procedure Specific Information
Note: The Id output parameter won't contain any values, if the workspace has already been shared previously (with the same member).If the rules specified below are not followed, the procedure will fail with an error.
Parameter groups
When executing this stored procedure, exactly one group from the following group of parameters must be specified:Single-share group
Use this group when you want to share the workspace with a single member.- UserEmail or GroupId (but not both)
- AccessLevel
Multi-share group
Use this group when you want to share the workspace with multiple members.- MultiShareAggregate
MultiShareAggregate
The value provided for the MultiShareAggregate parameter must be an array of JSON objects in the following format:[
{
"userEmail": "[email protected]",
"accessLevel": "VIEWER"
},
{
"groupId": 123456,
"accessLevel": "EDITOR"
},
// ...
]
In more detail:
- The array must contain at least one valid share object.
- For each share object in the array, either the userEmail or the groupId field must be specified (but not both).
- For each share object in the array, the accessLevel field must be specified.
- For each share object in the array, the value provided for the accessLevel field must be one of the values documented in the AccessLevel parameter's description below.
Email parameters
The following parameters can be used to configure the email that is sent to the members with which the workspace is shared. They can be used only when SendEmail=true.- CcMe
- EmailSubject
- EmailMessage
Examples
For examples on how to use this stored procedure, refer to the following queries:-- Single Share
EXECUTE ShareWorkspace WorkspaceId = '3947571576786820', UserEmail = '[email protected]', AccessLevel = 'VIEWER';
-- Multi Share
EXECUTE 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. |