1

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.

1
  • 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, 2013 at 13:30

1 Answer 1

1

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|[email protected]";
user.AutoFillSubDisplayText = "";
user.AutoFillTitleText = "[email protected]\nTenant\[email protected]";
user.Description = "[email protected]";
user.DisplayText = "Ian Chivers";
user.DomainText = "kwsservices-7c59c4bf8d655a.sharepoint.com";
user.EntityType = "User";
user.IsResolved = true;
user.Key = "i:0#.f|membership|[email protected]";
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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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