Share via


WorkflowClient.GetWorkflowAsync(Guid, RequestContext) Method

Definition

[Protocol Method] Get a specific workflow.

  • This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual System.Threading.Tasks.Task<Azure.Response> GetWorkflowAsync (Guid workflowId, Azure.RequestContext context);
abstract member GetWorkflowAsync : Guid * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetWorkflowAsync : Guid * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetWorkflowAsync (workflowId As Guid, context As RequestContext) As Task(Of Response)

Parameters

workflowId
Guid

The workflow id.

context
RequestContext

The request context, which can override default behaviors of the client pipeline on a per-call basis.

Returns

The response returned from the service.

Exceptions

Service returned a non-success status code.

Examples

This sample shows how to call GetWorkflowAsync and parse the result.

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

Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("actionDag").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("isEnabled").ToString());
Console.WriteLine(result.GetProperty("description").ToString());

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

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

Response response = await client.GetWorkflowAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("actionDag").ToString());
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("type").ToString());
Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossaryHierarchy").ToString());
Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underCollection").ToString());
Console.WriteLine(result.GetProperty("triggers")[0].GetProperty("underGlossary").ToString());
Console.WriteLine(result.GetProperty("createdTime").ToString());
Console.WriteLine(result.GetProperty("createdBy").ToString());
Console.WriteLine(result.GetProperty("lastUpdateTime").ToString());
Console.WriteLine(result.GetProperty("updatedBy").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("isEnabled").ToString());
Console.WriteLine(result.GetProperty("description").ToString());

Applies to