Quick Start (Base64): Purging process data using the web service API

The following C# .NET code purges data from a process named SecureDocument. A filter is used that specifies to purge data for those process instances where the process variable named inValue is greater than 200.

/* 
    * Ensure that you create a .NET client assembly that uses  
    * base64 encoding. This is required to populate a BLOB  
    * object with data or retrieve data from a BLOB object. 
    *  
    * For information, see "Invoking LiveCycle using Base64 Encoding"  
    * in Programming with LiveCycle 
    */ 
using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Data; 
using System.IO; 
 
namespace PurgeProcessDataWSApp 
{ 
       class DistillerTest 
       { 
           [STAThread] 
           static void Main(string[] args) 
           { 
               try 
               { 
                   //Create a ProcessManagerService object 
                   ProcessManagerService myProcessManager = new ProcessManagerService(); 
 
                   //Provide authentication credentials to the service 
                   myProcessManager.Credentials = new System.Net.NetworkCredential( 
                       "administrator", 
                       "password" 
                       ); 
 
                   //Prepare parameters to use in the purge operation 
                   long age = 10;  // in seconds 
                   Boolean includeChildren = false;// don't include children processes 
                   int status = 3;   // purge both completed and terminated processes 
                   short minor = 0; 
                   short major = 1; 
 
                   //Create the ConditionFilter object to filter  
                   //out unwanted instances of the process 
                   ConditionFilter filter = new ConditionFilter(); 
                   filter.variable = "inValue"; 
                   filter.condition = ConditionEnum.GREATER_THAN; 
                   filter.value = "200" ;  
     
                   //Delete process instances that contain a  
                   //process variable named inValue whose value 
                   //is greater than 200 
                   myProcessManager.purgeProcess( 
                       "SecureDocument", 
                       major, 
                       true, 
                       minor, 
                       true, 
                       status, 
                       true, 
                       age, 
                       true, 
                       filter, 
                       includeChildren, 
                       true); 
               } 
 
 
               catch (Exception ee) 
               { 
                   Console.WriteLine("An unexpected exception was encountered: " + ee.Message + "\n" + ee.StackTrace); 
               } 
           } 
       } 
}