DocumentClient.CreateUserAsync
Method
Definition
Overloads
| CreateUserAsync(String, User, RequestOptions) |
Creates a user object as an asychronous operation in the Azure DocumentDB database service. |
| CreateUserAsync(Uri, User, RequestOptions) |
Creates a user as an asychronous operation in the Azure DocumentDB database service. |
CreateUserAsync(String, User, RequestOptions)
Creates a user object as an asychronous operation in the Azure DocumentDB database service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.User>> CreateUserAsync (string databaseLink, Microsoft.Azure.Documents.User user, Microsoft.Azure.Documents.Client.RequestOptions options = null);
- databaseLink
- String
The link of the database to create the user in. E.g. dbs/db_rid/
- options
- RequestOptions
(Optional) The request options for the request.
A task object representing the service response for the asynchronous operation which contains the created User object.
If either databaseLink or user 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:
| StatusCode | Reason for exception |
|---|---|
| 400 | BadRequest - This means something was wrong with the request supplied. |
| 403 | Forbidden - You have reached your quota of user objects for this database. Contact support to have this quota increased. |
| 409 | Conflict - This means a User with an id matching the id you supplied already existed. |
CreateUserAsync(Uri, User, RequestOptions)
Creates a user as an asychronous operation in the Azure DocumentDB database service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.User>> CreateUserAsync (Uri databaseUri, Microsoft.Azure.Documents.User user, Microsoft.Azure.Documents.Client.RequestOptions options = null);
- databaseUri
- Uri
the URI of the database to create the user in.
- user
- User
the Microsoft.Azure.Documents.User object.
- options
- RequestOptions
The request options for the request.
The task object representing the service response for the asynchronous operation.