Quick Start (Base64): Locking tasks using the web service API

The following C# code example locks a task that corresponds to the task identifier value of 2.

using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO ; 
     
namespace LockTask 
{ 
    class Class1 
    { 
         
        [STAThread] 
        static void Main(string[] args) 
        { 
            try 
            { 
                //Create a TaskManagerServiceService object 
                TaskManagerServiceService taskManager = new TaskManagerServiceService();  
                taskManager.Credentials = new System.Net.NetworkCredential("administrator", "password"); 
                 
                //Lock the task that corresponds to the task identifier value of 2 
                Boolean myBool = new Boolean(); 
                myBool = true; 
                taskManager.lockTask(2,myBool); 
            } 
 
            catch (Exception ee) 
            { 
                Console.WriteLine("An unexpected exception was encountered: " + ee.Message + "\n" + ee.StackTrace); 
            } 
         
        } 
    } 
}

// Ethnio survey code removed