Hi, im trying to get the internal status from all workflows in a sharepoint site. I asked this here:
https://sharepoint.stackexchange.com/questions/217585/get-workflow-status-sharepoint-2013/217591#217591
but the answer did not help me. I dont understand why I get always 0 Workflows if I have workflows running. I created a list, added the workflows. They start automatically when I create a new item. The workflow is showed with a column "wflow" ( so the name my workflow ). But when I use the code above or other snippets with a SPWorkflowManager I always get 0 workflows... Any ideas? Thanks in advance.
- foreach (SPWorkflow workflow in manager.GetItemWorkflows(item))
- {
- if (workflow.ParentAssociation.Name == "wflow")
- {
- foreach (SPField field in workflow.ParentList.Fields)
- {
- if (field is SPFieldWorkflowStatus)
- {
- SPFieldWorkflowStatus statusField = (SPFieldWorkflowStatus)field;
- if (statusField.Title == "wflow")
- {
- int statusValue = int.Parse(item[statusField.StaticName].ToString());
-
-
- System.Diagnostics.Debug.WriteLine(statusField.GetFieldValueAsHtml(statusValue).ToString());
-
- }
- }
- }
- }
- }