PeoplePicker and JQuery

MLEONKC 1 Reputation point

I have a custom page I am developing. I want to mimic the SharePoint peoplepicker on an HTML5/JQuery page. How would I go about that? Is there a way to export the site's users to XML and build the picker that way? Or is there a more straight-forward way?

SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,804 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,141 Reputation points

    Hi @MLEONKC ,

    Based on my research and testing, you can follow the script below to build the People Picker:

    $(document).ready(function() {    
    function initializePeoplePicker(peoplePickerElementId) {    
        var schema = {};    
        schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';    
        schema['SearchPrincipalSource'] = 15;    
        schema['ResolvePrincipalSource'] = 15;    
        schema['AllowMultipleValues'] = false;    
        schema['MaximumEntitySuggestions'] = 50;    
        schema['Width'] = '280px';    
        this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);    

    My test code and result:

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. MLEONKC 1 Reputation point

    Thanks - I get about 4 errors:

    • Strings is not defined in clienttemplates.js
    • ExecuteOrDelayUntilScriptLoaded is not defined in clientforms.jsp
    • jQuery.deferred exception: EnsureScript is not defined in jquery.min.js
    • Same error at the SPClientPeoplePicker line...