process list from K2 Server


Badge
HI
We developed a web application and we need to get a list of the processes from K2 Server.
How can we do that?
Is it possible to get only the process that the user has permission to start or view?

4 replies

Badge +1
You would probably need to use the K2 Server Manager object to accomplish this. I believe it is k2mng.dll. The object is undocumented (as are so many things about this product) so you may need to fiddle with it a bit to get the data you want.
Badge +1
i'm trying to use k2mng.dll to retrive all the processes in k2.

however, i'm receiving this error:

System.Exception: FinishDate at SourceCode.K2Mng.K2Manager.GetProcessInstances(String Folio)

at this line

Dim k2m As New SourceCode.K2Mng.K2Manager
Dim k2mprocinsts As SourceCode.K2Mng.ProcessInstances

k2m.Login("...")
>> k2mprocinsts = k2m.GetProcessInstances("...")

what could be the problem?
Badge +13
I am looking for a solution :idea: where I can display a list of processes the user can initiate.

With the included project above, it works only if the user is explicitly assigned to the process. It does not work when the user is in an AD group.

I looked through K2ROM and K2MNG help files and didn't see any APIs that would allow me to verify access prior to calling StartProcessInstance method.

How are you guys taking care of this?
Badge +9
You should have a couple of options:

1. Using K2ROM, if you call CreateProcessInstance (the step before the StartProcessInstance), for a process that you do not have permissions to start, you should receive an exception stating you don not have permissions to create this process. You could call this in a try-catch block. If the exception is thrown, then you know the user doesn't have permissions. The nice thing about this approach is that K2 will handle the resolution, regardless of whether the users is explicitly listed, or a member of a group.

2. Using K2MNG you can programatically find the explicit users listed in Service Manager (as you already know). You can also retrieve the AD groups listED for the process. You will then need to resolve the AD group membership yourself (via .NET System.DirectoryServices) and see if the specific user is a member of a group granted appropriate K2 permissions.

Reply