共用方式為


ConfigurationsClient.SetAsync Method

Definition

replace the mutable fields of the configuration registration.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.Configuration> SetAsync (Microsoft.Azure.Devices.Configuration configuration, bool onlyIfUnchanged = false, System.Threading.CancellationToken cancellationToken = default);
abstract member SetAsync : Microsoft.Azure.Devices.Configuration * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Configuration>
override this.SetAsync : Microsoft.Azure.Devices.Configuration * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.Configuration>
Public Overridable Function SetAsync (configuration As Configuration, Optional onlyIfUnchanged As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Configuration)

Parameters

configuration
Configuration

The configuration object with replaced fields.

onlyIfUnchanged
Boolean

If false, this operation will be performed even if the provided device identity has an out of date ETag. If true, the operation will throw a IotHubServiceException with PreconditionFailed if the provided configuration has an out of date ETag. An up-to-date ETag can be retrieved using GetAsync(String, CancellationToken).

cancellationToken
CancellationToken

The token which allows the operation to be canceled.

Returns

The configuration object with replaced ETags.

Exceptions

Thrown when the provided configuration is null.

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 cancellation token has requested cancellation.

Applies to