Interface ShareResources
- Namespace
- Smartsheet.Api
- Assembly
- smartsheet-csharp-sdk.dll
This interface provides methods to access Share resources.
Thread Safety: Implementation of this interface must be thread safe.
public interface ShareResources
Methods
DeleteShare(long, string)
Delete a share.
It mirrors to the following Smartsheet REST API method:
DELETE /workspaces/{workspaceId}/shares/{shareId}
DELETE /sheets/{sheetId}/shares/{shareId}
DELETE /reports/{reportId}/shares/{shareId}
void DeleteShare(long objectId, string shareId)
Parameters
objectId
longthe ID of the object to share, (report, sheet, or workspace)
shareId
stringthe ID of the user to whom the object is shared
Exceptions
- InvalidOperationException
if any argument is null or empty string
- InvalidRequestException
if there is any problem with the REST API request
- AuthorizationException
if there is any problem with the REST API authorization (access token)
- ResourceNotFoundException
if the resource cannot be found
- ServiceUnavailableException
if the REST API service is not available (possibly due to rate limiting)
- SmartsheetException
if there is any other error during the operation
GetShare(long, string)
Get a Share.
It mirrors to the following Smartsheet REST API method:
GET /workspaces/{workspaceId}/shares/{shareId}
GET /sheets/{sheetId}/shares/{shareId}
GET /reports/{reportId}/shares/{shareId}
Share GetShare(long objectId, string shareId)
Parameters
Returns
- Share
the share (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null).
Exceptions
- InvalidOperationException
if any argument is null or empty string
- InvalidRequestException
if there is any problem with the REST API request
- AuthorizationException
if there is any problem with the REST API authorization (access token)
- ResourceNotFoundException
if the resource cannot be found
- ServiceUnavailableException
if the REST API service is not available (possibly due to rate limiting)
- SmartsheetException
if there is any other error during the operation
ListShares(long, PaginationParameters?, ShareScope?)
List shares of a given object.
It mirrors to the following Smartsheet REST API method:
GET /workspaces/{workspaceId}/shares
GET /sheets/{sheetId}/shares
GET /reports/{reportId}/shares
PaginatedResult<Share> ListShares(long objectId, PaginationParameters? paging = null, ShareScope? shareScope = null)
Parameters
objectId
longthe object Id
paging
PaginationParametersthe pagination request
shareScope
ShareScope?when specified with a value of Workspace, the response will contain both item-level shares (scope=‘ITEM’) and workspace-level shares (scope='WORKSPACE’).
Returns
- PaginatedResult<Share>
the list of Share objects (note that an empty list will be returned if there is none).
Exceptions
- InvalidOperationException
if any argument is null or empty string
- InvalidRequestException
if there is any problem with the REST API request
- AuthorizationException
if there is any problem with the REST API authorization (access token)
- ResourceNotFoundException
if the resource cannot be found
- ServiceUnavailableException
if the REST API service is not available (possibly due to rate limiting)
- SmartsheetException
if there is any other error during the operation
ShareTo(long, IEnumerable<Share>, bool?)
Shares a Sheet with the specified Users and Groups.
It mirrors to the following Smartsheet REST API method:
POST /workspaces/{workspaceId}/shares
POST /sheets/{sheetId}/shares
POST /reports/{reportId}/shares
IList<Share> ShareTo(long objectId, IEnumerable<Share> shares, bool? sendEmail = null)
Parameters
objectId
longthe Id of the object, (report, sheet, or workspace)
shares
IEnumerable<Share>the share objects
sendEmail
bool?(optional): Either true or false to indicate whether or not to notify the user by email. Default is false.
Returns
Exceptions
- InvalidOperationException
if any argument is null or empty string
- InvalidRequestException
if there is any problem with the REST API request
- AuthorizationException
if there is any problem with the REST API authorization (access token)
- ResourceNotFoundException
if the resource cannot be found
- ServiceUnavailableException
if the REST API service is not available (possibly due to rate limiting)
- SmartsheetException
if there is any other error during the operation
UpdateShare(long, Share)
Updates the access level of a User or Group for the specified Object.
It mirrors to the following Smartsheet REST API method:
PUT /workspaces/{workspaceId}/shares/{shareId}
PUT /sheets/{sheetId}/shares/{shareId}
PUT /reports/{reportId}/shares/{shareId}
Share UpdateShare(long objectId, Share share)
Parameters
Returns
- Share
the updated share (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null).
Exceptions
- InvalidOperationException
if any argument is null or empty string
- InvalidRequestException
if there is any problem with the REST API request
- AuthorizationException
if there is any problem with the REST API authorization (access token)
- ResourceNotFoundException
if the resource cannot be found
- ServiceUnavailableException
if the REST API service is not available (possibly due to rate limiting)
- SmartsheetException
if there is any other error during the operation