次の方法で共有


Attachments.Download(String, String, RequestContext) メソッド

定義

指定された入力 filePath の応答として添付ファイルをダウンロードして返します。

public virtual Azure.Response Download (string partyId, string attachmentId, Azure.RequestContext context = default);
abstract member Download : string * string * Azure.RequestContext -> Azure.Response
override this.Download : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function Download (partyId As String, attachmentId As String, Optional context As RequestContext = Nothing) As Response

パラメーター

partyId
String

関連付けられたパーティの ID。

attachmentId
String

ダウンロードする添付ファイルの ID。

context
RequestContext

要求コンテキスト。これは、呼び出しごとにクライアント パイプラインの既定の動作をオーバーライドできます。

戻り値

サービスから返された応答。

例外

partyId または attachmentId が null です。

partyId または attachmentId が空の文字列であり、空でないと想定されていました。

サービスから成功以外の状態コードが返されました。

このサンプルでは、必要なパラメーターを使用して Download を呼び出し、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var client = new FarmBeatsClient(credential).GetAttachmentsClient(<2022-11-01-preview>);

Response response = client.Download("<partyId>", "<attachmentId>");
if (response.ContentStream != null)
{
    using(Stream outFileStream = File.OpenWrite("<filePath>")
    {
        response.ContentStream.CopyTo(outFileStream);
    }
}

適用対象