WorkflowRunsClient.GetWorkflowRunsAsync Method

Definition

[Protocol Method] List workflow runs.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.AsyncPageable<BinaryData> GetWorkflowRunsAsync (string viewMode, string timeWindow, string orderby, System.Collections.Generic.IEnumerable<string> runStatuses, System.Collections.Generic.IEnumerable<string> workflowIds, System.Collections.Generic.IEnumerable<string> requestors, int? maxpagesize, Azure.RequestContext context);
abstract member GetWorkflowRunsAsync : string * string * string * seq<string> * seq<string> * seq<string> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetWorkflowRunsAsync : string * string * string * seq<string> * seq<string> * seq<string> * Nullable<int> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetWorkflowRunsAsync (viewMode As String, timeWindow As String, orderby As String, runStatuses As IEnumerable(Of String), workflowIds As IEnumerable(Of String), requestors As IEnumerable(Of String), maxpagesize As Nullable(Of Integer), context As RequestContext) As AsyncPageable(Of BinaryData)

Parameters

viewMode
String

To filter user's workflow runs or view as admin.

timeWindow
String

Time window of filtering items. Allowed values: "1d" | "7d" | "30d" | "90d".

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".

runStatuses
IEnumerable<String>

Filter workflow runs by workflow run status.

workflowIds
IEnumerable<String>

Filter items by workflow id list.

requestors
IEnumerable<String>

Requestors' ids to filter.

maxpagesize
Nullable<Int32>

The maximum page size to get the items at one time. The default value is 100.

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 GetWorkflowRunsAsync and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential);

await foreach (BinaryData item in client.GetWorkflowRunsAsync(null, null, null, null, null, null, null, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("workflowId").ToString());
    Console.WriteLine(result.GetProperty("startTime").ToString());
    Console.WriteLine(result.GetProperty("requestor").ToString());
    Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
}

This sample shows how to call GetWorkflowRunsAsync with all parameters and parse the result.

Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowRunsClient client = new WorkflowRunsClient(endpoint, credential);

await foreach (BinaryData item in client.GetWorkflowRunsAsync("<viewMode>", "1d", "status desc", new string[] { "InProgress" }, new string[] { "<workflowIds>" }, new string[] { "<requestors>" }, 1234, null))
{
    JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("id").ToString());
    Console.WriteLine(result.GetProperty("workflowId").ToString());
    Console.WriteLine(result.GetProperty("startTime").ToString());
    Console.WriteLine(result.GetProperty("requestor").ToString());
    Console.WriteLine(result.GetProperty("userRequestId").ToString());
    Console.WriteLine(result.GetProperty("runPayload").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("runPayload").GetProperty("targetValue").ToString());
    Console.WriteLine(result.GetProperty("status").ToString());
    Console.WriteLine(result.GetProperty("endTime").ToString());
    Console.WriteLine(result.GetProperty("cancelTime").ToString());
    Console.WriteLine(result.GetProperty("cancelComment").ToString());
}

Applies to