Reputation: 241
I am creating a sharpeoint hosted app. I am uisng client side people picker control and trying to insert multiple user values in the Person/Group Field(Supervisor) and Getting this error "The user does not exist or is not unique." Below is my code, This code is working fine for single user and fails for multiple users . Can anyone help please..
var list = web.get_lists().getByTitle("StudentDetails");
var listCreationInformation = new SP.ListItemCreationInformation();
var listItem = list.addItem(listCreationInformation);
var peoplePicker = ClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;
// Get information about all users.
var users = peoplePicker.GetAllUserInfo();
// Get user keys.
var keys = peoplePicker.GetAllUserKeys();
var finalusers = new Array();
for (var i = 0; i < users.length; i++) {
var arryuser = users[i];
finalusers.push(SP.FieldUserValue.fromUser(arryuser.Key));
}
listItem.set_item("Supervisor", finalusers);
listItem.update();
ctx.load(listItem);
Thanks in Advance
Upvotes: 1
Views: 5262
Reputation: 241
Setting the Allow Multiple selections" as Yes for the Supervisor column. was worked for me. The solutions was suggested in the below link. http://www.c-sharpcorner.com/forums/insert-multiple-values-for-persongroup-field-using-jsom
Upvotes: 0