DocumentClient.DeleteDocumentCollectionAsync Method

Definition

Overloads

DeleteDocumentCollectionAsync(String, RequestOptions)

Delete a DocumentCollection from the Azure Cosmos DB service as an asynchronous operation.

DeleteDocumentCollectionAsync(Uri, RequestOptions)

Delete a collection as an asynchronous operation from the Azure Cosmos DB service.

DeleteDocumentCollectionAsync(String, RequestOptions)

Delete a DocumentCollection from the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>> DeleteDocumentCollectionAsync (string documentCollectionLink, Microsoft.Azure.Documents.Client.RequestOptions options = default);
abstract member DeleteDocumentCollectionAsync : string * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>>
override this.DeleteDocumentCollectionAsync : string * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>>
Public Function DeleteDocumentCollectionAsync (documentCollectionLink As String, Optional options As RequestOptions = Nothing) As Task(Of ResourceResponse(Of DocumentCollection))

Parameters

documentCollectionLink
String

The link of the Document to delete. E.g. dbs/db_rid/colls/col_rid/

options
RequestOptions

(Optional) The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which will contain information about the request issued.

Implements

Exceptions

If documentCollectionLink 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.

Examples

//Delete a collection using its selfLink property
//To get the collectionLink you would have to query for the Collection, using CreateDocumentCollectionQuery(),  and then refer to its .SelfLink property
await client.DeleteDocumentCollectionAsync(collectionLink);

See also

Applies to

DeleteDocumentCollectionAsync(Uri, RequestOptions)

Delete a collection as an asynchronous operation from the Azure Cosmos DB service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>> DeleteDocumentCollectionAsync (Uri documentCollectionUri, Microsoft.Azure.Documents.Client.RequestOptions options = default);
abstract member DeleteDocumentCollectionAsync : Uri * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>>
override this.DeleteDocumentCollectionAsync : Uri * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>>
Public Function DeleteDocumentCollectionAsync (documentCollectionUri As Uri, Optional options As RequestOptions = Nothing) As Task(Of ResourceResponse(Of DocumentCollection))

Parameters

documentCollectionUri
Uri

the URI of the document collection to delete.

options
RequestOptions

The request options for the request.

Returns

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

Implements

Applies to