Running process instances can be deleted using the K2.net™ 2003 Service Manager, is it possible to do this programmatically?
K2.net™ 2003 Service Manager makes use of K2MNG.dll. All the functionality exposed by K2.net™ 2003 Service Manager is encapsulated in K2MNG.dll. The following code sample can be used to delete a process instance based on the folio.
|// Create the K2MNG object (add reference to k2mng.dll (...\program files\k2.net\bin\k2mng.dll) |
SourceCode.K2Mng.K2Manager k2m = new SourceCode.K2Mng.K2Manager();
// Login to the K2 Server (user with K2 admin rights required)
k2m.Login([K2 Server Name], 5252, [(optionally) a K2 Connection String]);
// Return all processes with specified folio parameter
SourceCode.K2Mng.ProcessInstances processCollection = k2m.GetProcessInstances(folio);
// Loop through collection, returning process ID's
foreach(SourceCode.K2Mng.ProcessInstance k2process in processCollection)
long processID = k2process.ID;
// Delete relevant process instance, specifying true or false to delete log entries
bool isDeleted = k2m.DeleteProcessInstances(processID, true);