I am filling the div of a SPClientPeoplePicker with a name of a person via JQuery. Now I want SP to look after this Person without modifying this div any further.
Is it possible to use a trigger event for this? If yes which?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityCheck out the global variable SPClientPeoplePicker.SPClientPeoplePickerDict
. It's an object which is containing the clientside peoplepicker of the current page. You should be able to identify your peoplepicker by searching for the element with the key peoplepickerdivID + _TopSpan
for example ctl00_PlaceHolderMain_peoplePicker_TopSpan
.
for(var key in SPClientPeoplePicker.SPClientPeoplePickerDict){
//for every peoplepicker on the page
var picker = SPClientPeoplePicker.SPClientPeoplePickerDict[key];
//check out the peoplepicker object - there's a lot more you can do with it
console.log(picker);
//haven't found out what the second parameter does actually but it works like this
picker.BatchAddUserKeysOperation(['domain\\loginname'], 0);
}
for(var key in SPClientPeoplePicker.SPClientPeoplePickerDict){
//for every peoplepicker on the page
var picker = SPClientPeoplePicker.SPClientPeoplePickerDict[key];
//check out the peoplepicker object - there's a lot more you can do with it
console.log(picker);
//how to trigger the search
var searchString = 'test';
picker.LatestSearchQueryStr = searchString;
var someInt = picker.AddPickerSearchQuery(searchString);
picker.ExecutePickerQuery([someInt], function(j, h) {
var g = JSON.parse(h.m_value);
if (picker.ShowingLocalSuggestions()) {
var f = SPClientPeoplePicker.AugmentEntitySuggestions(picker, g, true)
, i = picker.CurrentLocalSuggestions.length + f.length
, e = [];
if (f.length != 0) {
e.push(SPClientAutoFill.BuildAutoFillSeparatorMenuItem());
e = e.concat(f)
}
e = picker.CurrentLocalSuggestions.concat(e);
e = SPClientPeoplePicker.AddAutoFillMetaData(picker, e, i);
picker.ShowAutoFill(e)
} else
picker.ShowAutoFill(SPClientPeoplePicker.BuildAutoFillMenuItems(picker, g))
}, function() {
picker: ;picker.SetServerError()
}, null );
}
.trigger("resolveuser")
or something like this? because I already have the persons name. I just need to select the Person itself via the SharePoint Picker
Oct 19, 2016 at 8:42