I know how to get all users in share point site by using c# code ,but i want to get all site users using csom javscript. Any ideas?

1 Answer 1


Just make a ajax request to the following url, and it will give you all site users


Full code using rest API

    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/siteusers",
    type: "GET",
    headers: {
        "accept": "application/json;odata=verbose",
    success: function(data) {
    error: function(error) {

Full code using csom javascript

function GetAllUsers() {
    var clientContext = new SP.ClientContext.get_current();

    var web = clientContext.get_web();

    var userInfoList = web.get_siteUserInfoList();

    this.collListItem = userInfoList.getItems();


    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

function onQuerySucceeded(sender, args) {

    var item = collListItem.itemAt(0);

    var profileNotes = item.get_item(‘Notes’);

function onQueryFailed(sender, args) {}

Above code taken from here

  • sandbox solutions it is posible?
    – chakri
    Oct 7, 2015 at 6:59
  • Yup ...... Make sure jquery is in your page Oct 7, 2015 at 7:01
  • Hi There, Mine is SP 2010 on tyring this script i am getting below error. "Microsoft.SharePoint.Client.UnknownError" It goes in error call back
    – shoab
    Oct 10, 2017 at 5:31
  • I got the same problem like shoab on SP 2013. Does nobody has an answer to this? Nov 21, 2017 at 9:25

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.