次の方法で共有


InsightAttachments.Download メソッド

定義

指定された入力 filePath の応答として insight-attachment をダウンロードして返します。

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

パラメーター

partyId
String

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

modelId
String

関連付けられたモデルの ID。 "BiomassModelId"、"SensorPlacementModelId"、"SoilMoistureModelId"、または任意のソリューション ID のいずれかを指定できます。

resourceType
String

レコードに関連付けられているリソースの種類。

resourceId
String

関連付けられているリソースの ID。

insightAttachmentId
String

分析情報添付ファイル リソースの ID。

context
RequestContext

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

戻り値

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

例外

partyIdmodelIdresourceTyperesourceId または insightAttachmentId が null です。

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

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

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

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

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

適用対象