I'd like to be able to default the client side people picker for SharePoint 2013 to the current (or any) user.

I've read the "How to" MSDN document here: http://msdn.microsoft.com/en-us/library/jj713593.aspx

But I can't find any documentation on the clientpeoplepicker.js file and it's functions. It's tricky trying to decipher what the events that fire javascript are actually doing.

Thanks, Ian.

  • Ian. I see you were able to set the current user to the people picker. By any chance do you know how to restrict the current user from being displayed in the people picker as in not displaying the current user in the drop down whens earched for him? Thank you!
    – TrollLord
    May 14 '13 at 13:30

This works, but I need to be able to construct the user object from the currently logged on user. Shouldn't be too difficult I hope !

var users = new Array(1);
var user = new Object();
user.AutoFillDisplayText = "Ian Chivers";
user.AutoFillKey = "i:0#.f|membership|ian@kwsservices.onmicrosoft.com";
user.AutoFillSubDisplayText = "";
user.AutoFillTitleText = "ian@kwsservices.onmicrosoft.com\nTenant\nian@kwsservices.onmicrosoft.com";
user.Description = "ian@kwsservices.onmicrosoft.com";
user.DisplayText = "Ian Chivers";
user.DomainText = "kwsservices-7c59c4bf8d655a.sharepoint.com";
user.EntityType = "User";
user.IsResolved = true;
user.Key = "i:0#.f|membership|ian@kwsservices.onmicrosoft.com";
user.LocalSearchTerm = "Ian";
user.ProviderDisplayName = "Tenant";
user.ProviderName = "Tenant";
user.Resolved = true;
users[0] = user;
this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, users, schema);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.