SPWorkflowStatus Enumeration
The default values for SPWorkflowStatus class workflows.
Namespace: Microsoft.SharePoint.Workflow
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
| Member name | Description | |
|---|---|---|
| Completed | Workflow completed. | |
| ErrorOccurred | An error occurred during the execution of the workflow. | |
| ErrorOccurredRetrying | Indicates that the workflow is being retried after an initial failure. | |
| FailedOnStart | Indicates that the workflow encountered an error when it started. | |
| FailedOnStartRetrying | Indicates that the workflow is being retried after it failed to start. | |
| InProgress | Workflow is currently in progress. | |
| Max | ||
| NotStarted | Workflow has not started. | |
| StoppedByUser | Workflow execution was halted by a specified user. | |
| ViewQueryOverflow |
SPWorkflowStatus Enum
Extracted with reflector:
[Flags]
public enum SPWorkflowState
{
All = 0xfff,
Cancelled = 8,
Completed = 4,
Expired = 0x20,
Expiring = 0x10,
Faulting = 0x40,
HasNewEvents = 0x400,
Locked = 1,
None = 0,
NotStarted = 0x800,
Orphaned = 0x200,
Running = 2,
Suspended = 0x100,
Terminated = 0x80
}
- 8/23/2007
- Fred Morrison
- 2/16/2010
- Jānis Veinbergs
SPWorkflowStatus Enum
Description
The SPWorkflowStatus enumeration contains integer values that correspond to ten different stages in the lifecycle of a workflow.
Usage Scenarios
You can use the SPWorkflowStatus enumeration values to check the progress of a workflow executing on a SPListItem. To do this, begin by obtaining the list item. The status is a value added to the SPListItem with an index that is the name of the workflow.
The following code samples illustrate how to check a workflow status.
C# Code Sample
//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;
Visual Basic.NET Code Sample
'Obtain a list item
Dim thisWeb As SPWeb = SPControl.GetContextWeb(Context)
Dim issuesList As SPLIst = thisWeb.Lists("Customer Issues")
Dim myItem As SPListItem = issuesList.Items(0)
'Get the workflow status value
Dim WorkflowStatusValue As int = myItem("MyWorkflow")
Dim WorkflowStatusString = _
System.Enum.GetName(GetType(SPWorkflowStatus), WorkflowStatusValue)
StatusLabel.Text = "The current status of the workflow is: " & _
WorkflowStatusString
- 3/28/2008
- Content Master Ltd