2

I'm trying to use sharepoint search rest api to return all the users in my organisation but it's missing a few for some reason:

This is what I'm trying:

      var url = _spPageContextInfo.webAbsoluteUrl + "/_api/search/query?querytext='*'&SourceId='b09a7990-05ea-4af9-81ef-edfab16c4e31'";
      var promise = $.ajax({
        url: url,
        type: "GET",
        dataType: "json",
        headers: {
          Accept: "application/json;odata=minimalmetadata"
        }
      })

The accounts have been around for a while so I don't think it's a crawl issue. I'm not sure what could cause that. I've gone into User Profile Service in Office365 and it shows the correct number of users.

Any ideas?

3

querytext='*' will not return all rows. By default, it will return 10 rows only. So you need paging now. The way I have implemented is given below:

querytext='*'&startrow=0&rowlimit=30&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'

startrow: From this index row will be started

rowlimit: Number of rows you want to display per page. In the first page, it will return 30 rows.

  • That was the problem @atish, thank you very much for explanation. – Batman Oct 3 '16 at 13:25

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.