ShareReport
Shares a report 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 report 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 report 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 report 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 report 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 ShareReport ReportId = '3947571576786820', UserEmail = '[email protected]', AccessLevel = 'VIEWER';
-- Multi Share
EXEC ShareReport ReportId = '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 |
| ReportId | String | True | The unique identifier of the report being shared. |
| UserEmail | String | False | The email of the user to share the report with. |
| GroupId | String | False | The unique identifier of the group to share the report with. |
| AccessLevel | String | False | The access level for the user or group on the shared report.
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 report with an email. |
| CcMe | Boolean | False | Boolean value indicating whether to send a copy of the email to the sharer of the report. |
| EmailSubject | String | False | The subject of the email for the shared report. |
| EmailMessage | String | False | The message of the email for the shared report. |
| MultiShareAggregate | String | False | A JSON array of share objects, containing the information required for sharing the report with multiple members. |
Result Set Columns
| Name | Type | Description |
| Success | Boolean | A boolean value indicating whether the operation was successful. Returns 'true' if the report was shared successfully, and 'false' otherwise. |
| Id | String | The unique identifiers of the shares that were created in CSV format. |