SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to start a particular workflow in a list from a timer job. Is there any sample code for starting the workflow in the timer job's Execute() method?

share|improve this question

Try this...

public override void Execute (Guid targetInstanceId)
    SPWorkflowManager workflowManager = 
    SPWorkflowAssociationCollection workflowAssociationCollection = 

    foreach (SPWorkflowAssociation workflowAssociation in workflowAssociationCollection)
        if (String.Compare(
                workflowAssociation.BaseId.ToString("B"), {"Workflow GUID"}, true) == 0)
            workflowManager.StartWorkflow("GETYOUR ITEM OR LIST OBJECT",
                        workflowAssociation, workflowAssociation.AssociationData, true); 
share|improve this answer
Hi Vivek, Thank you for this !! However have some questions, In the timer job I have conditions like if the list expiry date is greater than today, I need to send the reminder letter for the group member. Now which type of workflow i need to create? The GUID you mentioned, where I will get? Plz contact me on – Jithu Dec 28 '11 at 9:32

Refer my blogpost on this. I have provided sample code.

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Please don't just add a link. Add the actual content since a link may break in the future. Thx – Benny Skogberg Apr 24 '15 at 4:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.