6

I'm using a REST api to get data from the User Information List using

    https://servername/sitename/_api/Web/SiteUserInfoList/items

This works great but the list stops after 121 entries - ending with a line such as

    <link rel="next" href="https://servername/sitename/_api/Web/SiteUserInfoList/items?%24skiptoken=Paged%3dTRUE%26p_ID%3d2102" /> 

How should I go about calling the entire list?

2 Answers 2

10

Some options to do this:

  1. Use Listdata.svc:
    http://SiteURL/_vti_bin/listdata.svc/UserInformationList. This returns all the items.
  2. Use $top=5000:
    http://SiteURL/_api/Web/SiteUserInfoList/items?$top=5000. This will return all items within the threshold limit.
  3. Use GetItems
    This is a POST request where you can use an empty CAML query to return all the items. Please note that JSON format is default for this and it won't return in XML.

    Request would be like below:

    URL:
    http://SiteURL/_api/Web/lists/getbytitle('User Information List')/getitems

    Headers:
    Accept: application/json; odata=verbose X-RequestDigest: RequestDigest Content-Type: application/json; odata=verbose
    CAML query:
    { "query" : {"__metadata": {"type": "SP.CamlQuery" } , "ViewXml": "<View><Query></Query></View>" } }
2
  • Using getbytitle() isn't a sure thing here because the list can be renamed (and possibly has different default names in other localities).
    – JLRishe
    Jul 5, 2019 at 1:41
  • @JLRishe you can use the endpoint siteURL/_api/web/SiteUserInfoList/items then
    – Akhoy
    Jul 5, 2019 at 6:46
0

header must be included

Accept: application/json; odata=verbose
Content-Type: application/json

Your Answer

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

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