0

Can I use PnP JS library to get all Users to populate a People Picker Control ?

Regards,

Arioule

0

To populate a custom drop-down ( which you are calling as people picker field), first get the users from the site using following snippet:

 $pnp.sp.web.siteUsers.get().then(function(data) {
    var users = "";
    for (var i = 0; i < data.length; i++) {
        users += data[i].Id + " - " + data[i].Title + "<br/>";
    }
    document.getElementById("sample").innerHTML = users;
});

Now populate the drop-down with the above users, refer this

  • this will get all site users, is there any method to get all tenant level user. then i have to add that users to site. – Hafeez Hamza Nov 27 '18 at 12:22

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.