Getting task list or worklist items for a specific user

  • 30 May 2012
  • 1 reply
  • 0 views

Badge +6

I am trying to list out assigned tasks for a specific user in ASP.net. I looked at the API and the Smartobjects but am not sure if the user listed in the return values is the originating user or the destination user.


I only want to show the tasks for the destination user. Does anybody have an example.


thanks


1 reply

Badge +6

You can use below code


 


SourceCode.Workflow.Client.Connection oServer = new SourceCode.Workflow.Client.Connection();


 SourceCode.Workflow.Client.WorklistCriteria oCrit = new SourceCode.Workflow.Client.WorklistCriteria();


 SourceCode.Workflow.Client.Worklist oWorklist;


oServer.Open(ConfigurationManager.AppSettings["K2ServerName"]);


 


oCrit.NoData = true;


 oServer.ImpersonateUser("K2:" + “Domain/UserID”);


 oWorklist = oServer.OpenWorklist(oCrit);


 


 if (oWorklist.Count > 0)


{


                //You can iterate list of tasks


}


 

Reply