SPWorkflowAssociation.CreateListContentTypeAssociation method
Creates a workflow association that can then be added to a list content type.
Namespace: Microsoft.SharePoint.Workflow
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
'Declaration
Public Shared Function CreateListContentTypeAssociation ( _
baseTemplate As SPWorkflowTemplate, _
name As String, _
taskList As SPList, _
historyList As SPList _
) As SPWorkflowAssociation
'Usage
Dim baseTemplate As SPWorkflowTemplate
Dim name As String
Dim taskList As SPList
Dim historyList As SPList
Dim returnValue As SPWorkflowAssociation
returnValue = SPWorkflowAssociation.CreateListContentTypeAssociation(baseTemplate, _
name, taskList, historyList)
public static SPWorkflowAssociation CreateListContentTypeAssociation(
SPWorkflowTemplate baseTemplate,
string name,
SPList taskList,
SPList historyList
)
baseTemplate
Type: Microsoft.SharePoint.Workflow.SPWorkflowTemplateThe workflow template on which to base this workflow association.
name
Type: System.StringThe name to give to this workflow association.
taskList
Type: Microsoft.SharePoint.SPListThe task list on which to create workflow tasks for this workflow association.
historyList
Type: Microsoft.SharePoint.SPListThe list to which to log workflow history events.
Type: Microsoft.SharePoint.Workflow.SPWorkflowAssociation
An SPWorkflowAssociation that represents the workflow association.
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 contains only spaces or tabs. |
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.
Microsoft.SharePoint.Workflow namespace
Workflows in Windows SharePoint Services
Workflow Development for Windows SharePoint Services
Workflow Object Model in Windows SharePoint Services Overview