WorkflowTaskClient.GetWorkflowTask(Guid, RequestContext) 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 a workflow task.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
public virtual Azure.Response GetWorkflowTask (Guid taskId, Azure.RequestContext context);
abstract member GetWorkflowTask : Guid * Azure.RequestContext -> Azure.Response
override this.GetWorkflowTask : Guid * Azure.RequestContext -> Azure.Response
Public Overridable Function GetWorkflowTask (taskId As Guid, context As RequestContext) As Response
Parameters
- taskId
- Guid
The task 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 GetWorkflowTask and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential);
Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);
JsonElement result = JsonDocument.Parse(response.ContentStream).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 GetWorkflowTask with all parameters and parse the result.
Uri endpoint = new Uri("<endpoint>");
TokenCredential credential = new DefaultAzureCredential();
WorkflowTaskClient client = new WorkflowTaskClient(endpoint, credential);
Response response = client.GetWorkflowTask(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null);
JsonElement result = JsonDocument.Parse(response.ContentStream).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