IDocumentClient.ReadAttachmentFeedAsync メソッド

定義

オーバーロード

ReadAttachmentFeedAsync(String, FeedOptions, CancellationToken)

Azure Cosmos DB サービスからドキュメントの Attachment フィード (シーケンス) を非同期操作として読み取ります。

ReadAttachmentFeedAsync(Uri, FeedOptions, CancellationToken)

Azure Cosmos DB サービスの非同期操作として、ドキュメントの添付ファイルのフィード (シーケンス) を読み取ります。

ReadAttachmentFeedAsync(String, FeedOptions, CancellationToken)

Azure Cosmos DB サービスからドキュメントの Attachment フィード (シーケンス) を非同期操作として読み取ります。

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>>
Public Function ReadAttachmentFeedAsync (attachmentsLink As String, Optional options As FeedOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of FeedResponse(Of Attachment))

パラメーター

attachmentsLink
String

読み取るリソースの SelfLink。 例: /dbs/db_rid/colls/coll_rid/docs/doc_rid/attachments/

options
FeedOptions

(省略可能)要求の要求オプション。

cancellationToken
CancellationToken

(省略可能) CancellationToken 取り消しの通知を受け取るために他のオブジェクトまたはスレッドが使用できる 。

戻り値

System.Threading.Tasks読み取りリソース レコードをResourceResponse<TResource>含む をAttachmentラップする を含む 。

例外

が設定されていない場合 attachmentsLink

この例外により、さまざまな種類のエラーがカプセル化される可能性があります。 特定のエラーを特定するには、常に StatusCode プロパティを参照してください。 ドキュメントの作成時に取得できる一般的なコードは次のとおりです。

StatusCode例外の理由
404NotFound - これは、読み取ろうとしたリソース フィードが存在しなかったことを意味します。 親の取り除きが正しいことを確認します。
429TooManyRequests - つまり、1 秒あたりの要求ユニット数を超えています。 DocumentClientException.RetryAfter 値を調べ、この操作を再試行するまでの待機時間を確認します。

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));

こちらもご覧ください

適用対象

ReadAttachmentFeedAsync(Uri, FeedOptions, CancellationToken)

Azure Cosmos DB サービスの非同期操作として、ドキュメントの添付ファイルのフィード (シーケンス) を読み取ります。

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.Attachment>> ReadAttachmentFeedAsync (Uri documentUri, 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>>
Public Function ReadAttachmentFeedAsync (documentUri As Uri, Optional options As FeedOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of FeedResponse(Of Attachment))

パラメーター

documentUri
Uri

親ドキュメントの URI。

options
FeedOptions

(省略可能) FeedOptions 要求の 。

cancellationToken
CancellationToken

(省略可能) CancellationToken 取り消しの通知を受け取るために他のオブジェクトまたはスレッドが使用できる 。

戻り値

非同期操作のサービス応答を表すタスク オブジェクト。

適用対象