I want to start a particular workflow programatically based on the item that is edited inÃÂ a list. For this I have created all the required workflows on the list using Sharepoint . I have written Eventhandler for ItemUpdating event, and in that I try to start my workflow. The following is the code i use inside the event handler.
public override void ItemUpdating(SPItemEventProperties properties)
SPList oHorizon = properties.OpenWeb().Lists["Horizon Scanning"];
SPWorkflowManager manager = properties.OpenWeb().Site.WorkflowManager;
SPWorkflowAssociation asso = oHorizon.WorkflowAssociations;
SPWorkflow workflow = manager.StartWorkflow(properties.ListItem, asso, asso.AssociationData);
View Complete Post