共用方式為


SPWorkflowAssociation Class

Represents the association of a workflow template with a specific list or content type, and that contains members that return custom information about that workflow's association with the specific list or content type.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Administration.SPAutoSerializingObject
    Microsoft.SharePoint.Workflow.SPWorkflowAssociation

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

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public NotInheritable Class SPWorkflowAssociation _
    Inherits SPAutoSerializingObject _
    Implements IComparer

Dim instance As SPWorkflowAssociation
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public sealed class SPWorkflowAssociation : SPAutoSerializingObject, 
    IComparer

Remarks

A workflow association represents the binding of a workflow template to a specific list or content type. Workflow associations enable you to specify properties of the workflow as it applies to the specific list or content type to which you bind it.

A given workflow template can be bound to the same list or content type multiple times, resulting in multiple workflow associations.

For more information, see Workflow Stages.

To associate a workflow template to a list or document library, use the AddWorkflowAssociation method of the SPList object. To associate a workflow with a content type, use the AddWorkflowAssociation method of the SPContentType object. Both of these methods take an SPWorkflowAssociation object and add it to the specified list or content type, respectively. To create the appropriate workflow association, use the CreateListAssociation, CreateListContentTypeAssociation, or CreateSiteContentTypeAssociation method of the SPWorkflowAssociation object itself.

Use the RemoveWorkflowAssociation(SPWorkflowAssociation) method to remove a workflow association from a list, and the [SPContentType.RemoveWorkflowAssociation] method to remove a workflow association from a site or list content type.

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

SPWorkflowAssociation Members

Microsoft.SharePoint.Workflow Namespace

Other Resources

Workflows in Windows SharePoint Services

Workflow Development for Windows SharePoint Services

Workflow Object Model in Windows SharePoint Services Overview