Share via


SPWorkflowAssociation.CreateWebContentTypeAssociation Method

Creates a workflow association that can then be added to a content type that is scoped at the website level.

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

Syntax

'Declaration
Public Shared Function CreateWebContentTypeAssociation ( _
    baseTemplate As SPWorkflowTemplate, _
    name As String, _
    taskListName As String, _
    historyListName As String _
) As SPWorkflowAssociation
'Usage
Dim baseTemplate As SPWorkflowTemplate
Dim name As String
Dim taskListName As String
Dim historyListName As String
Dim returnValue As SPWorkflowAssociation

returnValue = SPWorkflowAssociation.CreateWebContentTypeAssociation(baseTemplate, _
    name, taskListName, historyListName)
public static SPWorkflowAssociation CreateWebContentTypeAssociation(
    SPWorkflowTemplate baseTemplate,
    string name,
    string taskListName,
    string historyListName
)

Parameters

  • name
    Type: System.String

    The name to give this workflow association.

  • taskListName
    Type: System.String

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

  • historyListName
    Type: System.String

    The list to which to log workflow history events.

Return Value

Type: Microsoft.SharePoint.Workflow.SPWorkflowAssociation
A workflow association.

Exceptions

Exception Condition
ArgumentNullException

baseTemplate or name is null .

- or -

The workflow template is private and cannot be re-associated.

- or -

The workflow template requires a task list and taskListName is null .

- or -

The workflow template requires a history list and historyListName is null .

ArgumentException

The name parameter contains only spaces or tabs.

Remarks

You can add the workflow association that is returned by this method to a site-level content type by calling the AddWorkflowAssociation(SPWorkflowAssociation) method of one of the content types in the content type collection of the website.

See Also

Reference

SPWorkflowAssociation Class

SPWorkflowAssociation Members

Microsoft.SharePoint.Workflow Namespace

ContentTypes