I need help trying to get the Process originator. It seems to return back results for ACTIVE processes only and not completed ones. Any idea what i'm doing wrong here?
public string GetProcessInstanceOriginator(long procInst)
{
try
{
string k2Server = "Teknck2stage";
string k2ProcessName = "ITFARITFAR";
string tmpOriginator = "";
SourceCode.K2Mng.K2Manager K2Man = new SourceCode.K2Mng.K2Manager();
if (K2Man.Login(k2Server, 5252))
{
SourceCode.K2Mng.ProcessInstances ProcessInstances = K2Man.GetProcessInstancesAll(@k2ProcessName, "%", "%", null, null);
foreach (SourceCode.K2Mng.ProcessInstance ProcessInstance in ProcessInstances)
{
if (ProcessInstance.ID == procInst)
{
tmpOriginator = ProcessInstance.Originator;
return tmpOriginator;
}
}
}
return tmpOriginator;
}
catch (Exception ex)
{
throw ex;
}
}