次の方法で共有


DigitalTwinsClient.UpdateComponentAsync メソッド

定義

デジタル ツイン上のコンポーネントのプロパティを非同期的に更新します。

public virtual System.Threading.Tasks.Task<Azure.Response> UpdateComponentAsync(string digitalTwinId, string componentName, Azure.JsonPatchDocument jsonPatchDocument, Azure.ETag? ifMatch = default, System.Threading.CancellationToken cancellationToken = default);
abstract member UpdateComponentAsync : string * string * Azure.JsonPatchDocument * Nullable<Azure.ETag> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
override this.UpdateComponentAsync : string * string * Azure.JsonPatchDocument * Nullable<Azure.ETag> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function UpdateComponentAsync (digitalTwinId As String, componentName As String, jsonPatchDocument As JsonPatchDocument, Optional ifMatch As Nullable(Of ETag) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response)

パラメーター

digitalTwinId
String

デジタル ツインの ID。

componentName
String

変更されるコンポーネント。

jsonPatchDocument
JsonPatchDocument

指定したデジタル ツインのコンポーネントに対して実行される application/json-patch+json 操作。

ifMatch
Nullable<ETag>

省略可能。 エンティティの ETag がこの省略可能な ETag または * (All) と一致する場合にのみ、操作を実行します。

cancellationToken
CancellationToken

キャンセル トークン。

戻り値

HTTP 応答 Response<T>。 この応答オブジェクトには、このリソースの更新された ETag を提供する HTTP ヘッダーが含まれています。

例外

サービスからのエラーをキャプチャする例外。 詳細については、 ErrorCode プロパティと Status プロパティを確認してください。

// Update Component1 by replacing the property ComponentProp1 value,
// using an optional utility to build the payload.
var componentJsonPatchDocument = new JsonPatchDocument();
componentJsonPatchDocument.AppendReplace("/ComponentProp1", "Some new value");
await client.UpdateComponentAsync(basicDtId, "Component1", componentJsonPatchDocument);
Console.WriteLine($"Updated component for digital twin '{basicDtId}'.");

注釈

その他のサンプルについては、 リポジトリのサンプルを参照してください。

適用対象

こちらもご覧ください