DocumentClient.UpsertPermissionAsync Method

Definition

Overloads

UpsertPermissionAsync(String, Permission, RequestOptions)

Upserts a permission on a user object in the Azure DocumentDB database service as an asychronous operation.

UpsertPermissionAsync(Uri, Permission, RequestOptions)

Upserts a permission as an asychronous operation in the Azure DocumentDB database service.

UpsertPermissionAsync(String, Permission, RequestOptions)

Upserts a permission on a user object in the Azure DocumentDB database service as an asychronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Permission>> UpsertPermissionAsync (string userLink, Microsoft.Azure.Documents.Permission permission, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
userLink
String

The link of the user to Upsert the permission for. E.g. dbs/db_rid/users/user_rid/

permission
Permission

The Permission object.

options
RequestOptions

(Optional) The request options for the request.

Returns

A task object representing the service response for the asynchronous operation which contains the upserted Permission object.

Exceptions

If either userLink or permission is not set.

Represents a consolidation of failures that occured during async processing. Look within InnerExceptions to find the actual exception(s)

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
400BadRequest - This means something was wrong with the request supplied.
403Forbidden - You have reached your quota of permission objects. Contact support to have this quota increased.
409Conflict - This means a Permission with an id matching the id you supplied already existed.

UpsertPermissionAsync(Uri, Permission, RequestOptions)

Upserts a permission as an asychronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Permission>> UpsertPermissionAsync (Uri userUri, Microsoft.Azure.Documents.Permission permission, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
userUri
Uri

the URI of the user to upsert the permission for.

permission
Permission

the Microsoft.Azure.Documents.Permission object.

options
RequestOptions

The request options for the request.

Returns

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