SPWorkflowAssociation.CreateWebAssociation method
Creates a workflow association that can then be added to an SPWeb object.
Namespace: Microsoft.SharePoint.Workflow
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Shared Function CreateWebAssociation ( _
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.CreateWebAssociation(baseTemplate, _
name, taskList, historyList)
public static SPWorkflowAssociation CreateWebAssociation(
SPWorkflowTemplate baseTemplate,
string name,
SPList taskList,
SPList historyList
)
Parameters
baseTemplate
Type: Microsoft.SharePoint.Workflow.SPWorkflowTemplateThe workflow template on which to base this workflow association.
name
Type: System.StringThe name to give 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.
Return value
Type: Microsoft.SharePoint.Workflow.SPWorkflowAssociation
A workflow association that can be added to an SPWeb object.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The baseTemplate parameter is a null reference (Nothing in Visual Basic); or the name parameter is a null reference (Nothing in Visual Basic); or the template requires a task list (the default) and the taskList parameter is a null reference (Nothing in Visual Basic); or the template requires a history list (the default) and the historyList parameter is a null reference (Nothing in Visual Basic). |
ArgumentException | The name parameter consists completely of white-space. |
Remarks
You can add the workflow association that is returned by this method by calling the AddWorkflowAssociation(SPWorkflowAssociation) method of an SPWeb object.