IDocumentClient.ReplaceAttachmentAsync メソッド

定義

オーバーロード

ReplaceAttachmentAsync(Attachment, RequestOptions, CancellationToken)

Attachment Azure Cosmos DB サービスの を非同期操作として置き換えます。

ReplaceAttachmentAsync(Uri, Attachment, RequestOptions, CancellationToken)

添付ファイルを Azure Cosmos DB サービスの非同期操作として置き換えます。

ReplaceAttachmentAsync(Attachment, RequestOptions, CancellationToken)

Attachment Azure Cosmos DB サービスの を非同期操作として置き換えます。

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> ReplaceAttachmentAsync (Microsoft.Azure.Documents.Attachment attachment, Microsoft.Azure.Documents.Client.RequestOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceAttachmentAsync : Microsoft.Azure.Documents.Attachment * Microsoft.Azure.Documents.Client.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>>
Public Function ReplaceAttachmentAsync (attachment As Attachment, Optional options As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse(Of Attachment))

パラメーター

attachment
Attachment

既存のリソースを に置き換えるために更新 Attachment された 。

options
RequestOptions

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

cancellationToken
CancellationToken

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

戻り値

System.Threading.Tasks更新されたリソース レコードをResourceResponse<TResource>含む をAttachmentラップする を含む 。

例外

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

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

StatusCode例外の理由
404NotFound - 削除しようとしたリソースが存在しなかったことを意味します。

//Fetch the item to be updated
Attachment attachment = client.CreateAttachmentQuery(attachmentLink)
                            .Where(r => r.Id == "attachment id")
                            .AsEnumerable()
                            .SingleOrDefault();

//Update some properties on the found resource
attachment.MediaLink = "updated value";

//Now persist these changes to the database by replacing the original resource
Attachment updated = await client.ReplaceAttachmentAsync(attachment);

こちらもご覧ください

適用対象

ReplaceAttachmentAsync(Uri, Attachment, RequestOptions, CancellationToken)

添付ファイルを Azure Cosmos DB サービスの非同期操作として置き換えます。

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>> ReplaceAttachmentAsync (Uri attachmentUri, Microsoft.Azure.Documents.Attachment attachment, Microsoft.Azure.Documents.Client.RequestOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ReplaceAttachmentAsync : Uri * Microsoft.Azure.Documents.Attachment * Microsoft.Azure.Documents.Client.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Attachment>>
Public Function ReplaceAttachmentAsync (attachmentUri As Uri, attachment As Attachment, Optional options As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResourceResponse(Of Attachment))

パラメーター

attachmentUri
Uri

更新する添付ファイルの URI。

attachment
Attachment

添付ファイル リソース。

options
RequestOptions

(省略可能) RequestOptions 要求の 。

cancellationToken
CancellationToken

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

戻り値

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

適用対象