TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tarun D
NA
1.3k
114.5k
Insert Multiple values for Person/Group Field using JSOM
Jul 25 2016 8:17 AM
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 = SPClientPeoplePicker.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
Reply
Answers (
4
)
Error: Access Denied
how to give different site permission.