SPWorkflowAssociation.CreateWebContentTypeAssociation Method
SharePoint 2010
Creates a workflow association that can then be added to a content type that is scoped at the website level.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public static SPWorkflowAssociation CreateWebContentTypeAssociation( SPWorkflowTemplate baseTemplate, string name, string taskListName, string historyListName )
Parameters
- baseTemplate
- Type: Microsoft.SharePoint.Workflow.SPWorkflowTemplate
The workflow template on which to base this workflow association.
- 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.
| 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. |
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.