Programmatically attach workflow to List Item of SharePoint List - SharePoint-InfoPath.com


Programmatically attach workflow to List Item of SharePoint List

Posted by Somnath Matere on March 30, 2011

In this article, I will explain how to programmatically attach workflow to list item of SharePoint list. Workflow can be attached to a list while adding new item or updating the item.
Following method can be used to attach workflow to list item programmatically
Public void AttachWorkflowToListItem... [read more]

Rating

5/5

Reviews

An example using C# to attach a specific workflow to a list item in SharePoint programmatically using the AttachWorkflowToListItem() and LookupAndStartWorkflow() functions shown in the article.

AttachWorkflowToListItem() is the primary function, which makes a call to the LookupAndStartWorkflow() function, passing a SPListItem, SPWorkflowManager and SPWorkflowAssociationCollection object along with the ID of the workflow to start.


Similar examples:
[SP 2010 & Workflows] Can I programmatically c# attach a workflow to multiple document libraries / lists ? (MSDN thread with answer)

How to associate a SharePoint workflow using the Client Object Model? (Stackoverflow Q&A)

Add, remove and start Workflows using C# (Lasse Christensen)

Adding and Removing Workflow Associations Programmatically:
How to Remove and Add workflow in List programmatically?

By GeorgeH on July 31, 2011 2:45AM

Submit a review:

Login required.