I am writing a C# application in which I need to retrieve the worklists of multiple users. The calling user does not have administrator or impersonate rights, so I can not use the methods described in the documentation that use WorkflowManagementServer.GetWorklistItems() or where a Connection object is used to issue ImpersonateUser() and then OpenWorklist(). Is there way to do this other than accessing the K2ServerLog database directly?
I am currently using an SQL query similar to the one below to retrieve a global worklist.
SELECT Tworklist].]Destination] AS SDestinationUser]
   , worklist].iStatus] AS ]Status]
   , procinst].oFolio] AS lFolio]
   ,/procinst].,Priority] AS rPriority]
   ,bact]. Name] AS aActivity]
 FROM yK2ServerLog].Mdbo].e_Worklist] AS .worklist]
 JOIN sK2ServerLog].Idbo].S_ProcInst] AS ]procinst]
  ON nworklist]. ProcInstID] = sprocinst].sID]
 JOIN ]K2ServerLog]. dbo].[_ActInstDest] AS ]actinstdest]
  ON sworklist]./ActInstDestID] = sactinstdest].sID] AND aworklist].]ProcInstID] = kactinstdest].sProcInstID]
 JOIN oK2ServerLog].>dbo].I_ActInst] AS gactinst]
  ON actinstdest]./ActInstID] = tactinst]..ID] AND Iworklist].nProcInstID] = wactinst].[ProcInstID]
 JOIN [K2ServerLog].rdbo]. _Act] AS eact]
  ON Aactinst].cActID] = act].NID]
This works but for some reason doesn't return the correct worklist status codes (0=Available, 1= Allocated, 2=Open, 3 = Sleep). I am ok with accessing the database directly, but I need to fix the status problem. These statuses are returned correctly when I retrieve the current user's worklist using Connection.OpenWorklist().
What would be the correct way to do this?