You can use the listWorkItems()
method provided by WorkflowService
web service interface.
I'm adding here the Java version showing how to retrieve work item data since I'm not confident with C#, but the procedure is almost the same:
WorkItemResult result = wfSvc.listWorkItems(null);
List<WorkItem> items = result.getWorkItems();
for (WorkItem item : items){
// Attached data
List<ApplicationData> dataList =
wfSvc.getWorkItemData(item.getProcessID(), item.getSubProcessID(), item.getID());
for (ApplicationData data : dataList){
if (data instanceof AttributeData){
AttributeData aData = (AttributeData) data;
AttributeGroupDefinition groupDef = aData.getAttributes();
for (Attribute attr : groupDef.getAttributes()) {
if (attr instanceof StringAttribute) {
StringAttribute sAttr = (StringAttribute) attr;
System.out.println("Attr: " + sAttr.getDisplayName()+ " (" + sAttr.getValues().get(0) + ")");
}
}
}
}
}
The main point here is that the listWorkItems
method allows you to easily access each work item's ProcessID
, SubProcessID
and ID
values.