I've done a small program to export data from Project Server to Sharepoint Server 2016, as the number of exporter field is dynamic, I had to use sql db (because CSOM doesn't allow to use other baseline than baseline 0)

So now it's pretty finish, I just have a last issue to fix In my SQL DB, I have some person which are extracted as a string, if I tried to copy this value via my program in a field Person, I have an error message, so I'd like to know how can I pass transform this string to a person?

Thank you for your help


Here is the code snippet:

using Microsoft.SharePoint;  
using Microsoft.SharePoint.Client;  
ClientContext context = new ClientContext("SiteNameXXX");  
List list = context.Web.Lists.GetByTitle("ListNameXXX");  
ListItem item;  
string name = "GET NAME FROM SQL";   
if (name != "") {  
    User userTest = context.Web.EnsureUser(testName);  
    testName = userTest.Id.ToString() + ";#" + userTest.LoginName.ToString();  
    ListItem item;  
    item["PeoplePickerField"] = name;  

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.