WorkflowTasksClient.GetWorkflowTasksAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
[Protocol Method] Get all workflow tasks.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.AsyncPageable<BinaryData> GetWorkflowTasksAsync (string viewMode, System.Collections.Generic.IEnumerable<string> workflowIds, string timeWindow, int? maxpagesize, string orderby, System.Collections.Generic.IEnumerable<string> taskTypes, System.Collections.Generic.IEnumerable<string> taskStatuses, System.Collections.Generic.IEnumerable<string> requestors, System.Collections.Generic.IEnumerable<string> assignees, string workflowNameKeyword, Azure.RequestContext context);
abstract member GetWorkflowTasksAsync : string * seq<string> * string * Nullable<int> * string * seq<string> * seq<string> * seq<string> * seq<string> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetWorkflowTasksAsync : string * seq<string> * string * Nullable<int> * string * seq<string> * seq<string> * seq<string> * seq<string> * string * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetWorkflowTasksAsync (viewMode As String, workflowIds As IEnumerable(Of String), timeWindow As String, maxpagesize As Nullable(Of Integer), orderby As String, taskTypes As IEnumerable(Of String), taskStatuses As IEnumerable(Of String), requestors As IEnumerable(Of String), assignees As IEnumerable(Of String), workflowNameKeyword As String, context As RequestContext) As AsyncPageable(Of BinaryData)
Parameters
- viewMode
- String
To filter user's sent, received or history workflow tasks.
- workflowIds
- IEnumerable<String>
Filter items by workflow id list.
- timeWindow
- String
Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d".
The maximum page size to get the items at one time. The default value is 100.
- orderby
- String
The key word which used to sort the results. Allowed values: "status desc" | "status asc" | "requestor desc" | "requestor asc" | "startTime desc" | "startTime asc" | "createdTime desc" | "createdTime asc".
- taskTypes
- IEnumerable<String>
Filter items by workflow task type.
- taskStatuses
- IEnumerable<String>
Filter workflow tasks by status.
- requestors
- IEnumerable<String>
Requestors' ids to filter.
- assignees
- IEnumerable<String>
Assignees' ids to filter.
- workflowNameKeyword
- String
The key word which could used to filter workflow item with related workflow.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The AsyncPageable<T> from the service containing a list of BinaryData objects. Details of the body schema for each item in the collection are in the Remarks section below.
Exceptions
Service returned a non-success status code.
Examples
This sample shows how to call GetWorkflowTasksAsync and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential);
await foreach (BinaryData item in client.GetWorkflowTasksAsync(null, null, null, null, null, null, null, null, null, null, null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("workflowRunId").ToString());
Console.WriteLine(result.GetProperty("workflowId").ToString());
Console.WriteLine(result.GetProperty("requestor").ToString());
Console.WriteLine(result.GetProperty("createdTime").ToString());
Console.WriteLine(result.GetProperty("lastUpdateTime").ToString());
Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString());
}
This sample shows how to call GetWorkflowTasksAsync with all parameters and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowTasksClient client = new WorkflowTasksClient(endpoint, credential);
await foreach (BinaryData item in client.GetWorkflowTasksAsync("<viewMode>", new string[] { "<workflowIds>" }, "1d", 1234, "status desc", new string[] { "Approval" }, new string[] { "InProgress" }, new string[] { "<requestors>" }, new string[] { "<assignees>" }, "<workflowNameKeyword>", null))
{
JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("title").ToString());
Console.WriteLine(result.GetProperty("workflowRunId").ToString());
Console.WriteLine(result.GetProperty("workflowId").ToString());
Console.WriteLine(result.GetProperty("requestor").ToString());
Console.WriteLine(result.GetProperty("createdTime").ToString());
Console.WriteLine(result.GetProperty("lastUpdateTime").ToString());
Console.WriteLine(result.GetProperty("payload").GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("payload").GetProperty("targetValue").ToString());
Console.WriteLine(result.GetProperty("payload").GetProperty("payload").ToString());
Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("lastRemindTime").ToString());
Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("nextRemindTime").ToString());
Console.WriteLine(result.GetProperty("reminderInfo").GetProperty("reminderSettings").ToString());
Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("lastExpiryNotificationTime").ToString());
Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("nextExpiryNotificationTime").ToString());
Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expiryTime").ToString());
Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("expireAfter").ToString());
Console.WriteLine(result.GetProperty("expiryInfo").GetProperty("expirySettings").GetProperty("notifyOnExpiration")[0].ToString());
}
Applies to
Azure SDK for .NET