Share via


SPFieldWorkflowStatus Class

Represents a workflow status field.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPField
    Microsoft.SharePoint.SPFieldMultiChoice
      Microsoft.SharePoint.SPFieldChoice
        Microsoft.SharePoint.SPFieldWorkflowStatus

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public Class SPFieldWorkflowStatus _
    Inherits SPFieldChoice

Dim instance As SPFieldWorkflowStatus
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public class SPFieldWorkflowStatus : SPFieldChoice

Remarks

An instance of the SPFieldWorkflowStatus class that represents a field of type SPFieldType.WorkflowStatus.

When you add a workflow association to a list or content type, a WorkflowStatus field is automatically added to the field collection. You can get an SPFieldWorkflowStatus object that represents the field by calling the GetField(String) method. This method requires a name string as an argument. Pass the value of the Name property of the SPWorkflowAssociation object that you added to the list or content type. The following example demonstrates the technique.

Dim association As SPWorkflowAssociation = _
    SPWorkflowAssociation.CreateListAssociation(template, workflowName, taskList, historyList) 
list.AddWorkflowAssociation(association)
Dim statusField As SPFieldWorkflowStatus = CType(list.Fields.GetField(association.Name), SPFieldWorkflowStatus)
SPWorkflowAssociation association = 
    SPWorkflowAssociation.CreateListAssociation(template, workflowName, taskList, historyList);
list.AddWorkflowAssociation(association);
SPFieldWorkflowStatus statusField = list.Fields.GetField(association.Name) as SPFieldWorkflowStatus;

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPFieldWorkflowStatus Members

Microsoft.SharePoint Namespace

SPFieldType

Other Resources

Field Element (List - Definition)