Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
    
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

1 Answer 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|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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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