DocumentClient.DeleteAttachmentAsync Method

Definition

Overloads

DeleteAttachmentAsync(String, RequestOptions)

Delete an Attachment from the the Azure DocumentDB database service as an asynchronous operation.

DeleteAttachmentAsync(Uri, RequestOptions)

Delete an attachment as an asynchronous operation from the Azure DocumentDB database service.

DeleteAttachmentAsync(String, RequestOptions)

Delete an Attachment from the the Azure DocumentDB database service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> DeleteAttachmentAsync (string attachmentLink, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
attachmentLink
String

The link of the Attachment to delete. E.g. dbs/db_rid/colls/col_rid/docs/doc_rid/attachments/attachment_rid/

options
RequestOptions

(Optional) Any options you wish to set for this request.

Returns
Exceptions

If attachmentLink is not set.

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
404NotFound - This means the resource you tried to delete did not exist.

DeleteAttachmentAsync(Uri, RequestOptions)

Delete an attachment as an asynchronous operation from the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> DeleteAttachmentAsync (Uri attachmentUri, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
attachmentUri
Uri

the URI of the attachment to delete.

options
RequestOptions

The request options for the request.

Returns

The task object representing the service response for the asynchronous operation.