Click to Rate and Give Feedback
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
This page is specific to
The 2010 product release

Other versions are also available for the following:
SPWorkflowAssociation..::.CreateListAssociation Method

Creates a workflow association that can then be added to a list.

Namespace:  Microsoft.SharePoint.Workflow
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Visual Basic (Declaration)
Public Shared Function CreateListAssociation ( _
    baseTemplate As SPWorkflowTemplate, _
    name As String, _
    taskList As SPList, _
    historyList As SPList _
) As SPWorkflowAssociation
Visual Basic (Usage)
Dim baseTemplate As SPWorkflowTemplate
Dim name As String
Dim taskList As SPList
Dim historyList As SPList
Dim returnValue As SPWorkflowAssociation

returnValue = SPWorkflowAssociation.CreateListAssociation(baseTemplate, _
    name, taskList, historyList)
C#
public static SPWorkflowAssociation CreateListAssociation(
    SPWorkflowTemplate baseTemplate,
    string name,
    SPList taskList,
    SPList historyList
)

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.
taskList
Type: Microsoft.SharePoint..::.SPList
The task list on which to create workflow tasks for this workflow association.
historyList
Type: Microsoft.SharePoint..::.SPList
The list to which to log workflow history events.

Return Value

Type: Microsoft.SharePoint.Workflow..::.SPWorkflowAssociation
An SPWorkflowAssociation that represents the workflow association.
ExceptionCondition
ArgumentNullException

The argument passed to the baseTemplate parameter is nullNothingnullptra null reference (Nothing in Visual Basic); or the argument to the name parameter is nullNothingnullptra null reference (Nothing in Visual Basic); or the template requires a task list (the default) and the argument to the taskList parameter is nullNothingnullptra null reference (Nothing in Visual Basic); or the template requires a history list (the default) and the argument to the historyList parameter is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentException

The string passed to the name parameter contains only spaces or tabs.

To associate a workflow template with a list or document library, use the AddWorkflowAssociation method of the SPList object. This method takes an SPWorkflowAssociation object and adds it to the specified list.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker