共用方式為


DigitalTwinsClient.GetAsync<T>(String, CancellationToken) Method

Definition

Gets a strongly-typed digital twin.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.DigitalTwinGetResponse<T>> GetAsync<T> (string digitalTwinId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.DigitalTwinGetResponse<'T>>
override this.GetAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.DigitalTwinGetResponse<'T>>
Public Overridable Function GetAsync(Of T) (digitalTwinId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of DigitalTwinGetResponse(Of T))

Type Parameters

T

Parameters

digitalTwinId
String

The Id of the digital twin.

cancellationToken
CancellationToken

The cancellation token.

Returns

The deserialized application/json digital twin and the ETag for the digital twin.

Exceptions

When the provided digitalTwinId is null.

When the provided digitalTwinId is empty or whitespace.

Thrown if IoT hub responded to the request with a non-successful status code. For example, if the provided request was throttled, IotHubServiceException with ThrottlingException is thrown. For a complete list of possible error cases, see IotHubServiceErrorCode.

If the HTTP request fails due to an underlying issue such as network connectivity, DNS failure, or server certificate validation.

If the provided cancellationToken has requested cancellation.

Applies to