This method retrieves the list of the current user’s workflow tasks for all workflows in the specified company.
Parameter |
Type |
Description |
---|---|---|
organizationKey |
Specifies the unique identifier of the company for which tasks are being retrieved. |
|
includeCompleted |
The value true indicates both complete and incomplete tasks will be returned. The value false indicates only incomplete tasks will be returned. |
Value |
Type |
Description |
---|---|---|
GetTasksForCurrentUserResult |
A list of the current user’s workflow tasks for the specific company. |
The following C# example retrieves the list of the current user’s workflow tasks for the sample company. The list of tasks is displayed in a dialog.
Be sure to use the URL and port for your workflow server. |
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using Microsoft.Dynamics.Workflow.Proxy; namespace WorkflowWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; WorkflowTask[] tasks; // Create an instance of the web service DynamicsWorkflow wsWorkflow = new DynamicsWorkflow(); // Specify the URL used to access the Workflow web service wsWorkflow.Url = "http://WorkflowServer:10072/_vti_bin/WorkflowService.asmx"; // Be sure that default credentials are being used wsWorkflow.UseDefaultCredentials = true; // Create the company key for the sample company companyKey = new CompanyKey(); companyKey.Id = (-1); // Get tasks for this user, including completed tasks tasks = wsWorkflow.GetTasksForCurrentUser(companyKey, true); // Display the list of tasks StringBuilder taskList = new StringBuilder(); foreach (WorkflowTask t in tasks) { taskList.AppendLine(t.AssignedTo + " -- " + t.Description); } MessageBox.Show(taskList.ToString()); } } }