Table of Contents

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, Stream, string, string?)

Attaches a file to the Sheet using a Stream.

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, Stream stream, string fileName, string? contentType = null)

Parameters

sheetId long

the sheetId

stream Stream

the file stream

fileName string

the file name

contentType string

the content type, can be null (defaults to "application/octet-stream")

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

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

sheetId long

the sheetId

file string

the file path

fileType string

the file type

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

AttachFileAsync(long, Stream, string, string?, CancellationToken)

Attaches a file to the Sheet using a Stream.

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

Task<Attachment> AttachFileAsync(long sheetId, Stream stream, string fileName, string? contentType = null, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

stream Stream

the file stream

fileName string

the file name

contentType string

the content type, can be null (defaults to "application/octet-stream")

cancellationToken CancellationToken

the cancellation token

Returns

Task<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

AttachFileAsync(long, string, string?, CancellationToken)

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

Task<Attachment> AttachFileAsync(long sheetId, string file, string? fileType = null, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

file string

the file path

fileType string

the file type

cancellationToken CancellationToken

the cancellation token

Returns

Task<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 long

the sheetId

attachment Attachment

the 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

AttachUrlAsync(long, Attachment, CancellationToken)

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”.

Task<Attachment> AttachUrlAsync(long sheetId, Attachment attachment, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

attachment Attachment

the attachment object

cancellationToken CancellationToken

the cancellation token

Returns

Task<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.

If the Attachment has multiple versions this deletes only the specific version specified by the attachmentId (each version has a different attachment ID).

It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/attachments/{attachmentId}

void DeleteAttachment(long sheetId, long attachmentId)

Parameters

sheetId long

the sheetId

attachmentId long

the attachmentId

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

DeleteAttachmentAsync(long, long, CancellationToken)

Deletes the Attachment.

If the Attachment has multiple versions this deletes only the specific version specified by the attachmentId (each version has a different attachment ID).

It mirrors to the following Smartsheet REST API method: DELETE /sheets/{sheetId}/attachments/{attachmentId}

Task DeleteAttachmentAsync(long sheetId, long attachmentId, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

attachmentId long

the attachmentId

cancellationToken CancellationToken

the cancellation token

Returns

Task

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

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

sheetId long

the sheetId

attachmentId long

the attachmentId

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

GetAttachmentAsync(long, long, CancellationToken)

Fetches the Attachment.

It mirrors to the following Smartsheet REST API method: GET /sheets/{sheetId}/attachments/{attachmentId}

Task<Attachment> GetAttachmentAsync(long sheetId, long attachmentId, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

attachmentId long

the attachmentId

cancellationToken CancellationToken

the cancellation token

Returns

Task<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.

This operation supports pagination of results. For more information, see Paging.
PaginatedResult<Attachment> ListAttachments(long sheetId, PaginationParameters? paging = null)

Parameters

sheetId long

the sheetId

paging PaginationParameters

the 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

ListAttachmentsAsync(long, PaginationParameters?, CancellationToken)

Gets a list of all Attachments that are on the Sheet, including Sheet, Row, and Discussion level Attachments.

This operation supports pagination of results. For more information, see Paging.
Task<PaginatedResult<Attachment>> ListAttachmentsAsync(long sheetId, PaginationParameters? paging = null, CancellationToken cancellationToken = default)

Parameters

sheetId long

the sheetId

paging PaginationParameters

the pagination

cancellationToken CancellationToken

the cancellation token

Returns

Task<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