Bagikan melalui


ScheduledJobsClient.ScheduleTwinUpdateAsync Method

Definition

Creates a new job to update twin tags and desired properties on one or multiple devices.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.TwinScheduledJob> ScheduleTwinUpdateAsync (string queryCondition, Microsoft.Azure.Devices.ClientTwin twin, DateTimeOffset startOnUtc, Microsoft.Azure.Devices.ScheduledJobsOptions scheduledJobsOptions = default, System.Threading.CancellationToken cancellationToken = default);
abstract member ScheduleTwinUpdateAsync : string * Microsoft.Azure.Devices.ClientTwin * DateTimeOffset * Microsoft.Azure.Devices.ScheduledJobsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.TwinScheduledJob>
override this.ScheduleTwinUpdateAsync : string * Microsoft.Azure.Devices.ClientTwin * DateTimeOffset * Microsoft.Azure.Devices.ScheduledJobsOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.TwinScheduledJob>
Public Overridable Function ScheduleTwinUpdateAsync (queryCondition As String, twin As ClientTwin, startOnUtc As DateTimeOffset, Optional scheduledJobsOptions As ScheduledJobsOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TwinScheduledJob)

Parameters

queryCondition
String

Query condition to evaluate which devices to run the job on.

twin
ClientTwin

Twin object to use for the update.

startOnUtc
DateTimeOffset

When to start the job, in UTC.

scheduledJobsOptions
ScheduledJobsOptions

Optional parameters for scheduled twin update, i.e: scheduledJobsOptions.JobId.JobId and scheduledJobsOptions.MaxExecutionTimeInSeconds.MaxExecutionTimeInSeconds.

cancellationToken
CancellationToken

Task cancellation token.

Returns

A job object.

Exceptions

When the provided scheduledJobsOptions.JobId.JobId or queryCondition or twin or startOnUtc or scheduledJobsOptions.MaxExecutionTimeInSeconds.MaxExecutionTimeInSeconds is null.

If the scheduledJobsOptions.JobId.JobId or queryCondition is empty or white space.

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