I have their Office 365 E-Mail and I need to have the Created By and Modified By columns refer to their user.


I've managed to solve it myself

var user = clientContext.Web.SiteUsers;
User targetUser = user.GetByEmail(creatorMail);
newItem["Author"] = targetUser;
newItem["Editor"] = targetUser;

There's a caveats when you update Author and Editor field in CSOM for SharePoint Online. I had inconsistent results so I wrote my discovery in the article: https://ikmoss.wordpress.com/2019/04/29/issues-when-updating-created-by-and-modified-by-fields-in-sharepoint-online-csom/

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.