共用方式為


SPWorkflowAssociation.CreateSiteContentTypeAssociation Method

NOTE: This API is now obsolete.

Creates a workflow association that can then be added to a site content type.

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

Syntax

'Declaration
<ObsoleteAttribute("Use CreateWebContentTypeAssociation() instead")> _
Public Shared Function CreateSiteContentTypeAssociation ( _
    baseTemplate As SPWorkflowTemplate, _
    name As String, _
    strTaskList As String, _
    strHistoryList As String _
) As SPWorkflowAssociation
'Usage
Dim baseTemplate As SPWorkflowTemplate
Dim name As String
Dim strTaskList As String
Dim strHistoryList As String
Dim returnValue As SPWorkflowAssociation

returnValue = SPWorkflowAssociation.CreateSiteContentTypeAssociation(baseTemplate, _
    name, strTaskList, strHistoryList)
[ObsoleteAttribute("Use CreateWebContentTypeAssociation() instead")]
public static SPWorkflowAssociation CreateSiteContentTypeAssociation(
    SPWorkflowTemplate baseTemplate,
    string name,
    string strTaskList,
    string strHistoryList
)

Parameters

  • name
    Type: System.String

    The name to give this workflow association.

  • strTaskList
    Type: System.String

    The task list on which to create workflow tasks for this workflow association.

  • strHistoryList
    Type: System.String

    The list to which to log workflow history events.

Return Value

Type: Microsoft.SharePoint.Workflow.SPWorkflowAssociation
An SPWorkflowAssociation that represents the workflow association.

Exceptions

Exception Condition
ArgumentNullException

The argument passed to the baseTemplate parameter is a null reference (Nothing in Visual Basic); or the argument to the name parameter is a null reference (Nothing in Visual Basic); or the template requires a task list (the default) and the argument to the taskList parameter is a null reference (Nothing in Visual Basic); or the template requires a history list (the default) and the argument to the historyList parameter is a null reference (Nothing in Visual Basic).

ArgumentException

The string passed to the name parameter consists completely of white-space.

Remarks

To associate a workflow with a content type, use the AddWorkflowAssociation method of the SPContentType object. This method takes an SPWorkflowAssociation object and adds it to the specified content type.

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