Skip to main content

Greetings  Everyone !, i want to run a loop over all the deployed processes on my k2 server. Now, i know that we can run a query on _procset table in k2log db but i was looking for some api which could help me achieve that...

Thanks in Advance !.. 

 

 

                          
 

Thanks Guys, figured it out !

In case someone else has this need, you should be able to use the SourceCode.Workflow.Management API to accomplish this.
can you share what you did?

Sure Chris,

Well i am sure there may be some other methods to achieve this, but this is the one which i stumbled upon first. I might be spending some more time in digging any other method to achieve the same. I will post my findings soon

but for now, following code works great

As bob mentioned we need to reference SourceCode.Workflow.Management Api and

 

// Build connection String

         SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            connectionString.Authenticate = true;
            connectionString.Host = "ServerName";
            connectionString.Integrated = true;
            connectionString.IsPrimaryLogin = true;
            connectionString.Port = 5555;
            WorkflowManagementServer workflowServer = new WorkflowManagementServer();           


            try
            {
            workflowServer.CreateConnection();
            workflowServer.Connection.Open(connectionString.ToString());

// Get All the process Folders....you should get your top level folders structure in here

// ProjectNameFolderName


            foreach (ProcessFolder pf in workflowServer.GetProcessFolders())
            {

// loop through all the processes in the folder.....

//result is :- All the deployed processes under ....


                       foreach (ProcessSet ps in pf.ProcessSets)
                        {

//.ProjectNameFolderName and outcome will be ProjectNameFolderNameProcessName


                           comboBox1.Items.Add(ps.FullName.ToString());
                        }
            }

 workflowServer.Connection.Close();

 

 


Reply