I've created a new Site Collection, and am building a List with a User field on it.

When I manually add items to that list, it lets me search for all the users in my Active Directory, even if they're not in the UserInformationList. Though I see that after I add them to a List Item, they do show up there. And the value stored in that User field is their ID on the UserInformationList.

The trouble is I want to edit this list programmatically from javascript in a SharePoint Add-In.

So how do I add users, that I get from with JSOM and the REST API, to a User field, also using JSOM and the REST API?


You don't want to edit the user info list in code directly. What you want to do instead is call SP.Web.EnsureUser() on each username. This adds the user to the info list if not already there and returns an object with the numeric ID, which you can then use in your subsequent code.


Your Answer

