Quick Start (Base64): Retrieving task information using the web service API

The following C# code example retrieves all tasks that are based on a process named MortgageLoan - Prebuilt . The status of each returned task is checked to ensure that it is a completed task. Information such as the name of the user who completed the task is retrieved and displayed.

using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO ;  
namespace RetrieveTaskInformation 
    class Class1 
        static void Main(string[] args) 
                //Create an OutputServiceService object 
                TaskManagerQueryServiceService queryManager = new TaskManagerQueryServiceService(); 
                queryManager.Credentials = new System.Net.NetworkCredential("administrator", "password"); 
                //Create an OutputServiceService object 
                TaskManagerServiceService taskManager = new TaskManagerServiceService(); 
                taskManager.Credentials = new System.Net.NetworkCredential("administrator", "password"); 
                //Create a Task Search Filter 
                TaskSearchFilter filter = new TaskSearchFilter(); 
                filter.serviceName = "MortgageLoan - Prebuilt";  
                //Perform the task search 
                Object[] allTasks = queryManager.taskSearch(filter); 
                //Determine the number of returned tasks 
                int num = allTasks.Length; 
                Boolean myTrue = true; 
                Boolean myFalse = false; 
                //Iterate through the Object array 
                for (int i=0; i<num;i++) 
                    //Extract the TaskRow instance from the Object array 
                    TaskRow myTask = (TaskRow)allTasks[i];     
                    //Ensure that the task is completed 
                    if (myTask.taskStatus == 100) 
                        //Get the identifier of the user who completed the task 
                        long taskId = myTask.taskId; 
                        TaskInfo taskInfo = taskManager.getTaskInfo(taskId,myTrue,myFalse,myFalse); 
                        ParticipantInfo user = taskInfo.assignedTo; 
                        String userId = user.specifiedUserId; 
                        //Display task information     
                        Console.WriteLine("The task identifier value is "+taskId  +"\n"+ 
                            "The user identifier is "+userId);  
            catch (Exception ee) 

// Ethnio survey code removed