Search code examples
c#sharepointworkflow

Starting sharepoint 2007 workflows simultaneously on list items using Timer job


I am trying to programmatically start a workflow on multiple items simultaneously of a sharepoint 2007 list, I have found code to start workflow programmatically but the issue is, The workflows don't start simultaneously, that is the workflow starts, completes and then only proceeds to start the next workflow.

foreach (SPListItem item in collListItems)
{
   item["timerJobInitiated"] = "Yes";
   item.Update();
   SPListItem wrkItem = list.GetItemById(item.ID);
   wrkflowmgr.StartWorkflow(wrkItem , wflassociation,wflassociation.AssociationData);
}

Solution

  • I was finally able to achieve this using multitasking, by starting workflows in threads. This provided the desired functionality. I have updated the entire code here as its too long to be posted here.