Interface SheetAttachmentResources
- Namespace
- Smartsheet.Api
- Assembly
- smartsheet-csharp-sdk.dll
This interface provides methods to access Attachment resources that are associated to a sheet object.
Thread Safety: Implementation of this interface must be thread safe.
public interface SheetAttachmentResources
Properties
VersioningResources
Return the AttachmentVersioningResources object that provides access to Versioning resources associated with Attachment resources.
AttachmentVersioningResources VersioningResources { get; }
Property Value
- AttachmentVersioningResources
the attachment versioning resources
Methods
AttachFile(long, string, string?)
Attaches a file to the Sheet.
This operation will always create a new attachment. To upload a new version of the same attachment, use the Attach New Version operation.
It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/attachments
Attachment AttachFile(long sheetId, string file, string? fileType = null)
Parameters
Returns
- Attachment
the newly created Attachment
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
AttachUrl(long, Attachment)
Attaches a URL to the Sheet.
It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/attachments
attachmentSubType is valid only for GOOGLE_DRIVE attachments which are Google Docs. It can optionally be included to indicate the type of a file. The following attachmentSubTypes are valid for GOOGLE_DRIVE attachments "DOCUMENT", "SPREADSHEET", "PRESENTATION", "PDF", "DRAWING".
When the attachment type is BOX_COM, DROPBOX, or GOOGLE_DRIVE (without an attachmentSubType specified), the mimeType will be derived by the file extension specified on the “name”.
Attachment AttachUrl(long sheetId, Attachment attachment)
Parameters
sheetId
longthe sheetId
attachment
Attachmentthe attachment object
Returns
- Attachment
the newly created Attachment
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
DeleteAttachment(long, long)
Deletes the Attachment.
It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/attachments/{attachmentId}
void DeleteAttachment(long sheetId, long attachmentId)
Parameters
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
GetAttachment(long, long)
Fetches the Attachment.
It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/attachments/{attachmentId}
Attachment GetAttachment(long sheetId, long attachmentId)
Parameters
Returns
- Attachment
the Attachment object. For File attachments, this will include a temporary URL for downloading the file. Currently, the temporary URL is set to expire in 120000 milliseconds, or 2 minutes.
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
ListAttachments(long, PaginationParameters?)
Gets a list of all Attachments that are on the Sheet, including Sheet, Row, and Discussion level Attachments.
PaginatedResult<Attachment> ListAttachments(long sheetId, PaginationParameters? paging = null)
Parameters
sheetId
longthe sheetId
paging
PaginationParametersthe pagination
Returns
- PaginatedResult<Attachment>
list of Attachment objects
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