DocumentClient.CreateAttachmentAsync Method

Definition

Overloads

CreateAttachmentAsync(String, Stream, MediaOptions, RequestOptions)

Creates an Attachment with the contents of the provided mediaStream as an asynchronous operation in the Azure DocumentDB database service.

CreateAttachmentAsync(Uri, Stream, MediaOptions, RequestOptions)

Creates an attachment as an asynchronous operation in the Azure DocumentDB database service.

CreateAttachmentAsync(String, Object, RequestOptions)

Creates an attachment as an asychronous operation in the Azure DocumentDB database service.

CreateAttachmentAsync(Uri, Object, RequestOptions)

Creates an attachment as an asychronous operation in the Azure DocumentDB database service.

CreateAttachmentAsync(String, Stream, MediaOptions, RequestOptions)

Creates an Attachment with the contents of the provided mediaStream as an asynchronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> CreateAttachmentAsync (string attachmentsLink, System.IO.Stream mediaStream, Microsoft.Azure.Documents.Client.MediaOptions options = null, Microsoft.Azure.Documents.Client.RequestOptions requestOptions = null);
Parameters
attachmentsLink
String

The attachments link for the document. E.g. dbs/db_rid/colls/col_rid/docs/doc_rid/attachments/

mediaStream
Stream

the Stream of the attachment media.

options
MediaOptions

the MediaOptions for the request.

requestOptions
RequestOptions

Request options.

Returns

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

Exceptions

If either attachmentsLink or mediaStream is not set.

CreateAttachmentAsync(Uri, Stream, MediaOptions, RequestOptions)

Creates an attachment as an asynchronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> CreateAttachmentAsync (Uri documentUri, System.IO.Stream mediaStream, Microsoft.Azure.Documents.Client.MediaOptions options = null, Microsoft.Azure.Documents.Client.RequestOptions requestOptions = null);
Parameters
documentUri
Uri

the URI of the document to create an attachment for.

mediaStream
Stream

the stream of the attachment media.

options
MediaOptions

the media options for the request.

requestOptions
RequestOptions

The request options for the request.

Returns

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

CreateAttachmentAsync(String, Object, RequestOptions)

Creates an attachment as an asychronous operation in the Azure DocumentDB database service.

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

The link of the parent document for this new attachment. E.g. dbs/db_rid/colls/col_rid/docs/doc_rid/

attachment
Object

The attachment object.

options
RequestOptions

(Optional) The request options for the request.

Returns

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

CreateAttachmentAsync(Uri, Object, RequestOptions)

Creates an attachment as an asychronous operation in the Azure DocumentDB database service.

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

the URI of the document to create an attachment for.

attachment
Object

the attachment object.

options
RequestOptions

The request options for the request.

Returns

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