Pages

Showing posts with label How to get current status of workflow. Show all posts
Showing posts with label How to get current status of workflow. Show all posts

Tuesday, January 26, 2010

How to get current status of workflow from SharePoint object model

Reference Link:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx

Sample Code:
//Obtain a list item
SPWeb thisWeb = SPControl.GetContextWeb(Context);
SPList issuesList = thisWeb.Lists["Customer Issues"];
SPListItem myItem = issuesList.Items[0];
//Get the workflow status value
int WorkflowStatusValue = myItem["MyWorkflow"];
string WorkflowStatusString = System.Enum.GetName
        (typeof(SPWorkflowStatus), WorkflowStatusValue);
StatusLabel.Text = "The current status of the workflow is: " +
        WorkflowStatusString;