I have come across the client side people picker javascript. Right now the people picker accepts all users. Is there any way we can point it to a SharePoint Group. I only want users that are present in a SharePoint Group to be selected as a value for the people picker. Kindly help.

1 Answer 1


You could add a attribute schema['SharePointGroupID'] = 8;

Full demo:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>  
<script type="text/javascript" src="_layouts/15/clienttemplates.js"></script>  
<script type="text/javascript" src="_layouts/15/clientforms.js"></script>  
<script type="text/javascript" src="_layouts/15/clientpeoplepicker.js"></script>  
<script type="text/javascript" src="_layouts/15/autofill.js"></script>
    <label>User Name:</label>  
    <div id="_UserName"></div>  
<input type="button" id="button" value="submit">
$(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';  
    schema['SharePointGroupID'] = 8;
    this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);  
$("#button").click(function (){
function ensureUser() {  
var peoplePickerTopDivId = $('#_UserName').children().children().attr('id');  
var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerTopDivId];  
var users = peoplePicker.GetAllUserInfo();  
var arryuser = users[0];  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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