Find Instances of All Processes |
Scroll |
The ExecuteWorkflowQueryForAll operation can be used to find all running and/or finished instances of all workflow processes. The guide and code sample below teach you how to do that. The reference page of the ExecuteWorkflowQueryForAll method contains more details on parameters and usage.
If you want to get all instances of one workflow process, the ExecuteWorkflowQueryForProcess operation can be used.
1 |
Create a channel factory to the web service endpoint. |
2 |
Create a channel to the web service endpoint. |
3 |
Create request parameters |
4 |
Execute the query on the server |
5 |
Display the results in a message box. |
// 1. Create a channel factory to the web service endpoint
...
ChannelFactory<IThereforeService> channelFactory = new ChannelFactory<IThereforeService>(binding, endpoint);
// 2. Create a channel to the web service endpoint
IThereforeService service = channelFactory.CreateChannel();
// 3. Create requested parameters
ExecuteWorkflowQueryForAllParams parameters = new ExecuteWorkflowQueryForAllParams();
parameters.WorkflowFlags = Therefore.WebAPI.Service.Contract.v0001.Enums.WSWorkflowFlags.AllInstances;
// 4. Execute the query on the server
ExecuteWorkflowQueryForAllResponse response = service.ExecuteWorkflowQueryForAll(parameters);
// Optional 5. Display the results in the message box
MessageBox.Show("Number of rows returned: " + response.WorkflowQueryResultList.Count);