How to add multiple users to People picker using JSOM in SharePoint 2010, 2013,2016,2019 Online & Office 365?

Hello SharePointers,

Below is the JSOM script to add multiple user to people picker field in SharePoint list forms.

function InsertUserstopeoplePicker() {

var ctx = new SP.ClientContext(appWebUrl);
var CtxSite = new SP.AppContextSite(ctx, hostWebUrl);

var web = CtxSite.get_web(); 

var List = web.get_lists().getByTitle(‘Mytestlist’);

var itemCreateInfo = new SP.ListItemCreationInformation();
var oListItem = List.addItem(itemCreateInfo);

//Get User info
var peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDivExample_TopSpan;
var users = peoplePicker.GetAllUserInfo();
//Array to store users
var userObjs = [];
var userName = “”;
//Loop through the picker 
for (var i = 0; i < users.length; i++) {
userName = users[i][“Description”];

oListItem.set_item(‘Title’, “Employee Details”);
oListItem.set_item(‘Employee Name, userObjs);



ctx.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded), Function.createDelegate(this, onQueryFailed));

function onQuerySucceeded() {

function onQueryFailed(sender, args) {

$(“#output”).html(“Item failed”);

Happy SharePointing Folks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *