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 have a Custom List and the list attached with SharePoint Designer 2007 workflow where trigger when new item created.

If I programmatically create an item in a Custom List, will the action trigger the workflow?

below is the code fragment for programmatically create item in a Custom List.

using (SPSite site = new SPSite(_url))
    using (SPWeb web = site.OpenWeb())
        web.AllowUnsafeUpdates = true;

        SPList list = web.Lists["CustomListName"];
        SPListItem newItems = list.Items.Add();

        newItems["Title"] = "test";


        web.AllowUnsafeUpdates = false;

I've tried the code above and new item successfully created in the Custom List, but the workflow was not trigger, any idea?

Please help.

Thank you in advanced

share|improve this question
same problem for me. I have using SharePoint 2010 with build-in approval workflow. I have triggered the workflow when new item is created. I have create the new item in end user login only.. Sometimes workflow get triggered, sometimes doesn't..... :-( pls help me.. – user10007 Aug 10 '12 at 11:09
up vote 2 down vote accepted

A common issue is that SP1 had a security fix which prevents declarative workflows to start as the system account(as described here). So if you're running the code above as System then that's the cause.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.