I am adding an item to a sharepoint list in an ASP.Net MVC app using Microsoft.SharePoint.Client. One of the columns is a people picker. The people picker is used to send and email via a SP 2013 workflow attached to the list. I have two problems:

1} The workflow is not triggered when the item is added to the list from the MVC app.

2) even though the users name shows in the SP list and the name resolves, the email address must not be included when the code adds the item because when I manually trigger the workflow it fails, stating there is a null reference error. I altered the workflow and hard-coded an email address and it worked.

Here is the C# code that is adding the person:

Microsoft.SharePoint.Client.User reportOwner = clientContext.Web.EnsureUser(claimsPrefix + currentEmployeeInfo.EmployeeEmailAddress);
oListItem["ReportOwner"] = reportOwner;

which sets reportOwner to:


The value resolves in the people picker in the list and shows the display name of the user. I verified the SPD workflow for this column is set to use email address of this field.

Finally, the code adding the item using is as follows:


Everything is working except the workflow is not triggered when the item is added the people column does not seem to contain the email address.

EDIT: I went into the list item in SharePoint, delete the user's name and re-added it using the SharePoint UI and the workflow worked so I am definitely missing something when adding it through code.

Any ideas?


Ok. I am an idiot. The 2013 workflow wasn't executing because it was set to start manually, not when an item was added.

However, it is still failing because it can't seem to resolve the users name.

When I switched to a SP 2010 workflow, the email sends fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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