API For Returning Shared Worklist Items

  • 31 July 2014
  • 1 reply
  • 2 views

Badge +6

I'm developing a user control that returns all the worklist items for the logged-in user, and the code is as follows:

 

using (K2.Connection cn = new K2.Connection())

{

cn.Open(serverName, K2ServerConnection);

               

foreach (K2.WorklistItem worklistItem in cn.OpenWorklist(wc))

{

  // loop..

}

}

 

 

This works great.  Unfortunately, it does not return any worklist items that are shared.  So, for example, if another user is out of the office and selects me for K2 to forward all items to, that user's worklist items do not show up when I call OpenWorklist.  Is there any API for getting worklist items that have been forwarded to me?


1 reply

Badge +6

Never mind, I figured it out...

 

 

K2.

WorklistCriteria wc = new K2.WorklistCriteria();

                wc.AddFilterField(K2.

WCField.ProcessFullName, K2.WCCompare.Equal, name);

                wc.AddFilterField(K2.

WCLogical.AndBracket, K2.WCField.WorklistItemOwner, K2.WCWorklistItemOwner.Me.ToString(), K2.WCCompare.Equal, 0);

                wc.AddFilterField(K2.

WCLogical.Or, K2.WCField.WorklistItemOwner, K2.WCWorklistItemOwner.Other.ToString(), K2.WCCompare.Equal, 0);

Reply