Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

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 reenuiss@gmail.com –  Jithu Dec 28 '11 at 9:32

Your Answer


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