DocumentClient.ReadAttachmentFeedAsync Método

Definição

Sobrecargas

ReadAttachmentFeedAsync(String, FeedOptions, CancellationToken)

Lê o feed (sequência) de para Attachment um documento do serviço do Azure Cosmos DB como uma operação assíncrona.

ReadAttachmentFeedAsync(Uri, FeedOptions, CancellationToken)

Lê o feed (sequência) de anexos de um documento como uma operação assíncrona do serviço do Azure Cosmos DB.

ReadAttachmentFeedAsync(String, FeedOptions, CancellationToken)

Lê o feed (sequência) de para Attachment um documento do serviço do Azure Cosmos DB como uma operação assíncrona.

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

Parâmetros

attachmentsLink
String

O SelfLink dos recursos a serem lidos. Por exemplo, /dbs/db_rid/colls/coll_rid/docs/doc_rid/attachments/

options
FeedOptions

(Opcional) As opções de solicitação para a solicitação.

cancellationToken
CancellationToken

(Opcional) Um CancellationToken que pode ser usado por outros objetos ou threads para receber uma notificação de cancelamento.

Retornos

Um System.Threading.Tasks que contém um ResourceResponse<TResource> que encapsula um Attachment que contém o registro de recurso de leitura.

Implementações

Exceções

Se attachmentsLink não estiver definido.

Essa exceção pode encapsular muitos tipos diferentes de erros. Para determinar o erro específico, sempre examine a propriedade StatusCode. Alguns códigos comuns que você pode obter ao criar um Documento são:

StatusCodeMotivo da exceção
404NotFound - Isso significa que o feed de recursos que você tentou ler não existia. Verifique se os rids pai estão corretos.
429TooManyRequests - Isso significa que você excedeu o número de unidades de solicitação por segundo. Consulte o valor DocumentClientException.RetryAfter para ver quanto tempo você deve aguardar antes de repetir essa operação.

Exemplos

int count = 0;
string continuation = string.Empty;
do
{
    // Read Attachment feed 10 items at a time until there are no more to read
    FeedResponse<Attachment> response = await client.ReadAttachmentFeedAsync("/dbs/db_rid/colls/coll_rid/docs/doc_rid/attachments/ ",
                                                    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));

Confira também

Aplica-se a

ReadAttachmentFeedAsync(Uri, FeedOptions, CancellationToken)

Lê o feed (sequência) de anexos de um documento como uma operação assíncrona do serviço do Azure Cosmos DB.

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

Parâmetros

attachmentsUri
Uri

o URI dos anexos.

options
FeedOptions

As opções de solicitação para a solicitação.

cancellationToken
CancellationToken

(Opcional) CancellationToken que representa o cancelamento da solicitação.

Retornos

O objeto de tarefa que representa a resposta do serviço para a operação assíncrona.

Implementações

Aplica-se a