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)


Public Shared Function CreateWebContentTypeAssociation ( _
    baseTemplate As SPWorkflowTemplate, _
    name As String, _
    taskListName As String, _
    historyListName As String _
) As SPWorkflowAssociation
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


  • 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.


Exception Condition

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 .


The name parameter contains only spaces or tabs.


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


SPWorkflowAssociation class

SPWorkflowAssociation members

Microsoft.SharePoint.Workflow namespace