共用方式為


SPWorkflowAssociation.Enabled Property

Gets or sets a value that indicates whether the workflow association is enabled.

Namespace:  Microsoft.SharePoint.Workflow
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableAttribute> _
Public Property Enabled As Boolean
    Get
    Set
'Usage
Dim instance As SPWorkflowAssociation
Dim value As Boolean

value = instance.Enabled

instance.Enabled = value
[ClientCallableAttribute]
public bool Enabled { get; set; }

Property Value

Type: System.Boolean
true if it is enabled; otherwise, false.

Exceptions

Exception Condition
InvalidOperationException

The corresponding workflow feature is deactivated or the workflow is not deployed as part of a feature.

Remarks

Setting the Enabled property to false causes the workflow association not to be displayed in the user interface. This prevents users from starting new instances of the workflow. In addition, workflows that are configured to start automatically are no longer able to start automatically.

Setting the Enabled property to true does not change the values for the AllowManual, AutoStartCreate, or AutoStartChange properties. However, the option to start the workflow is again available in the user interface, and workflows that are configured to start automatically will start automatically.

See Also

Reference

SPWorkflowAssociation Class

SPWorkflowAssociation Members

Microsoft.SharePoint.Workflow Namespace

Other Resources

Workflows in SharePoint Foundation

Workflow Development for SharePoint Foundation

Workflow Object Model Overview in SharePoint Foundation