ShareSheet
Shares a sheet with a user or group in your Smartsheet account.
Procedure Specific Information
Note: The Id output parameter won't contain any values, if the sheet 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 sheet with a single member.- UserEmail or GroupId (but not both)
- AccessLevel
Multi-share group
Use this group when you want to share the sheet 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 sheet 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 ShareSheet SheetId = '3947571576786820', UserEmail = '[email protected]', AccessLevel = 'VIEWER';
-- Multi Share
EXECUTE ShareSheet SheetId = '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 |
| SheetId | String | True | The unique identifier of the sheet being shared. |
| UserEmail | String | False | The email of the user to share the sheet with. |
| GroupId | String | False | The unique identifier of the group to share the sheet with. |
| AccessLevel | String | False | The access level for the user or group on the shared sheet.
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 sheet with an email. |
| CcMe | Boolean | False | Boolean value indicating whether to send a copy of the email to the sharer of the sheet. |
| EmailSubject | String | False | The subject of the email for the shared sheet. |
| EmailMessage | String | False | The message of the email for the shared sheet. |
| MultiShareAggregate | String | False | A JSON array of share objects, containing the information required for sharing the sheet with multiple members. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | A boolean value indicating whether the operation was successful. Returns 'true' if the sheet was shared successfully, and 'false' otherwise. |
| Id | String | The unique identifiers of the shares that were created in CSV format. |