Populate a SharePoint 2013 PeoplePicker field using JavaScript/jQuery

Here is a quick and fairly simple way to programmatically populate a SharePoint 2013 People Picker field with a user based on their email address. This example assumes you have more than one People Picker field on the page. You will need:

  • The display name of the People Picker Field
  • The email address of the user you want to add to the People Picker Field

Add the following code to either a Script Editor Web Part (inside <script> tags) or on your page in the PlaceHolderAdditionalPageHead, also in <script> tags:

var dispTitle = "";
var pickerDiv = $("[id$='ClientPeoplePicker'][title='" + dispTitle + "']");
var peoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[pickerDiv[0].id];
var usrObj = { 'Key': 'email@address.com'};
peoplePicker.AddUnresolvedUser(usrObj,true); 

In one case, I had to remove the “title” attribute filter from the pickerDiv var to get it to work, but it was the only People Picker on the page, so we were good.

Hope this helps!

Microsoft Ignite Summary

This past week was the first Microsoft Ignite conference in Chicago, IL. As a prior attendee of Microsoft’s BUILD conference each year, this was quite a change for me. There was a healthy mix of IT Pro, SysAdmin and Dev sessions, over 200 sessions in total for the week. There was also a consistent hint of Azure and Office 365 in every session, regardless of category or audience type. It’s absolutely clear Microsoft wants everyone in the cloud, mainly in Azure, and we saw that even in on-prem sessions. The expo was huge, with lots of opportunities to talk with both Microsoft and their partners. From hands-on labs to live and in some cases interactive demos, there seemed to be something for everyone there.
Continue reading Microsoft Ignite Summary

Posts and ramblings about SharePoint, software development, and other things I thought were cool