Share via


DocumentClient.ReadUserFeedAsync Method

Definition

Overloads

ReadUserFeedAsync(String, FeedOptions)

Reads the feed (sequence) of User for a database from the Azure Cosmos DB service as an asynchronous operation.

ReadUserFeedAsync(Uri, FeedOptions)

Reads the feed (sequence) of users for a database as an asynchronous operation from the Azure Cosmos DB service.

ReadUserFeedAsync(String, FeedOptions)

Reads the feed (sequence) of User for a database from the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>> ReadUserFeedAsync (string usersLink, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadUserFeedAsync : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>>
override this.ReadUserFeedAsync : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>>
Public Function ReadUserFeedAsync (usersLink As String, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of User))

Parameters

usersLink
String

The SelfLink of the resources to be read. E.g. /dbs/db_rid/users/

options
FeedOptions

(Optional) The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a User containing the read resource record.

Implements

Exceptions

If usersLink 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 feed you tried to read did not exist. Check the parent rids are correct.
429TooManyRequests - This means you have exceeded the number of request units per second. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation.

Examples

int count = 0;
string continuation = string.Empty;
do
{
    // Read the feed 10 items at a time until there are no more items to read
    FeedResponse<User> response = await client.ReadUserFeedAsync("/dbs/db_rid/users/",
                                                    new FeedOptions
                                                    {
                                                        MaxItemCount = 10,
                                                        RequestContinuation = continuation
                                                    });

    // Append the item count
    count += response.Count;

    // Get the continuation so that we know when to stop.
     continuation = response.ResponseContinuation;
} while (!string.IsNullOrEmpty(continuation));

See also

Applies to

ReadUserFeedAsync(Uri, FeedOptions)

Reads the feed (sequence) of users for a database as an asynchronous operation from the Azure Cosmos DB service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>> ReadUserFeedAsync (Uri usersUri, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadUserFeedAsync : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>>
override this.ReadUserFeedAsync : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.User>>
Public Function ReadUserFeedAsync (usersUri As Uri, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of User))

Parameters

usersUri
Uri

the URI for the users.

options
FeedOptions

The request options for the request.

Returns

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

Implements

Applies to