1

I have an API developed in ASP.net Web API 2.0 which inserts records into SharePoint 2013 list.

I am able to assign values to all the fields from the API except for the people picker fields, says

Invalid look-up value.\n\nA look-up field contains invalid data. Please check the value and try again.

My request body is:

{ "siteurl":"http://intranet.sbl.com/GAD/", "listname":"Appointment", "jsonfields":"{\"Title\":\"Test1\",\"Description\":\"Description1\",\"Appointment_x0020_Detail\":\"Description1\",\"Assign_x0020_To\":\"sbl\\\\roman.bajracharya\"}" }

Where "Assign_x0020_To":"sbl\\roman.bajracharya" is the value I am passing for the people picker with title Assign To, and "sbl" is the AD domain and "roman.bajracharya" is the username.

Can anybody help me out on this?

1 Answer 1

0

To add/update Person or Group field, you need the Id of user. Lets say, user Id in SharePoint site is 11 and the internal name of the field is Assign_x0020_To.

So the request will be like:

var data = {
    Assign_x0020_ToId: 11
};

If multiple user selection is enabled on Person or group field, you can set it's value like:

Assign_x0020_ToId: { 'results': [11,22] }

Note: You need to add Id with the field's internal name. You can get the internal name of your person or group column by following this article: How to find the Internal name of columns in SharePoint Online?

2

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.