你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

QueryClient.CreateJobsQueryAsync(JobQueryOptions, CancellationToken) 方法

定义

按类型和/或状态查询所有作业或查询作业。

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.QueryResponse<Microsoft.Azure.Devices.ScheduledJob>> CreateJobsQueryAsync(Microsoft.Azure.Devices.JobQueryOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateJobsQueryAsync : Microsoft.Azure.Devices.JobQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.QueryResponse<Microsoft.Azure.Devices.ScheduledJob>>
override this.CreateJobsQueryAsync : Microsoft.Azure.Devices.JobQueryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.QueryResponse<Microsoft.Azure.Devices.ScheduledJob>>
Public Overridable Function CreateJobsQueryAsync (Optional options As JobQueryOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of QueryResponse(Of ScheduledJob))

参数

options
JobQueryOptions

用于运行查询的可选参数。

cancellationToken
CancellationToken

任务取消令牌。

返回

查询作业的可迭代集。

例外

如果 IoT 中心使用不成功的状态代码响应了请求。 例如,如果提供的请求受到限制, IotHubServiceException 则会引发 with ThrottlingException 。 有关可能的错误情况的完整列表,请参阅 IotHubServiceErrorCode

如果 HTTP 请求因网络连接、DNS 故障或服务器证书验证等基础问题而失败。

如果提供的取消令牌已请求取消。

示例

QueryResponse<ScheduledJob> queriedJobs = await iotHubServiceClient.Query.CreateJobsQueryAsync(); while (await queriedJobs.MoveNextAsync()) { Console.WriteLine(queriedJobs.Current.JobId); }

适用于