Here’s the scenario:

I have a RunWithElevatedPrivileges method that adds a list item to my custom list. The custom list is associated with a workflow that gets triggered on Item Added. I have noticed that the workflow has the initiator set as ‘System Account’. I believe this is cause of the RunWithElevatedPriviledges.

Here’s the catch:

I have around 4 Tasks created in the workflow that are assigned to SPGroups. All of these tasks are not sending task assigned emails since the initiator is System Account. The individual user tasks are working fine though. When I start the workflow manually via a site collection admin account, the initiator is not System Account and the task emails are sent without any issues.

How can I get my workflow working with my task emails?

1 Answer 1


Inside RunWithElevatedPrivileges you should impersonate current user. Something like

var userToken = SPContext.Current.Web.AllUsers["domain\\user"].UserToken;
using(SPSite site = new SPSite(SiteURL, UserToken))

    list.Update(); //Will save the record as the selected user.
  • Thanks :)! It worked for me, However I am having an issue with the workflow canceling out maybe cause of a permission issue. Working on it now!
    – Muhammedh
    Commented Nov 19, 2014 at 9:42
  • Solved the above commented issue via anujabhojani.blogspot.com/2013/02/…
    – Muhammedh
    Commented Nov 19, 2014 at 10:02
  • Issue.. Still the Task Emails are not getting sent... I have a new user called 'domain\spwfinitiator'. Should I give any specific permissions to trigger the emails?
    – Muhammedh
    Commented Nov 19, 2014 at 10:58
  • Found the actual issue for the emails not getting sent.. I had to change the Group settings as 'Who Can View the Membership of the Group' to 'Everyone'. However Amal's solution is correct for the question :)!
    – Muhammedh
    Commented Nov 20, 2014 at 5:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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