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

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

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

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

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