Unable to Refresh Worklist using K2ROM

  • 21 July 2004
  • 2 replies
  • 2 views

Badge
Hi

I'm trying to search the worklist using K2ROM. If I call Refresh method on the worklist, I'm getting an exception with the following error message: "Invalid archive type"..


Code:

string redirectUrl = String.Empty;
string k2ServerName = String.Empty;

SourceCode.K2ROM.Connection k2Conn = new SourceCode.K2ROM.Connection();

try
{
SourceCode.K2ROM.Worklist currentWorklist;
SourceCode.K2ROM.WorklistItem currentWorklistItem;
SourceCode.K2ROM.WorklistCriteria oWorklistCriteria = new SourceCode.K2ROM.WorklistCriteria();

//Retrieving the server name from config file
k2ServerName = ConfigurationSettings.AppSettings["DeploymentK2Server"];

//Opening the connection to k2 server
k2Conn.Open(k2ServerName, "[;];Authentication=Windows");
//Setting up the criteria for worklist search
oWorklistCriteria.Platform="ASP";

//This sets the filter for CurrentProcessID Datafield
oWorklistCriteria.AddFilterField(SourceCode.K2ROM.WCLogical.And, SourceCode.K2ROM.WCField.ProcessData,
"IPCNavigationID", SourceCode.K2ROM.WCCompare.Equal, pK2NavigationID);

//Add Sort Order
oWorklistCriteria.AddSortField(SourceCode.K2ROM.WCField.ProcessStartDate,
SourceCode.K2ROM.WCSortOrder.Descending);

//Populate Custom Worklist
currentWorklist = k2Conn.OpenWorklist(oWorklistCriteria);

//If the worklist item is not found, we refresh the worklist.
if(currentWorklist.Count == 0)
{
int i = 0;
while(i < 10)
{
currentWorklist.Refresh(); //Exception is thrown at this point
if (currentWorklist.Count > 0)
{ break;
}
i++;
}
}

//We are expecting a single item in the result, hence select the first
//item

if (currentWorklist.Count > 0)
{
currentWorklistItem = currentWorklist[0];
redirectUrl = currentWorklistItem.Data;
}

}
catch(Exception ex)
{
throw ex;
}
finally
{
k2Conn.Close();
}

return redirectUrl;

2 replies

Badge
Anyone, please let me know where to find the list of values for the Platform. In the above script, the value is "ASP". Is there any other platform (value)?

oWorklistCriteria.Platform="ASP";
Badge +11
Please see: http://forum.k2workflow.com/viewtopic.php?p=1602#1602

K2.net 2003 only uses the "ASP" platform but the user can really define ANY other platform.

Regards,
Ockert

Reply