pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
749 stars 305 forks source link

Is there a limit on the number of list items returned? #3118

Closed SharonGilmore closed 2 weeks ago

SharonGilmore commented 4 weeks ago

What version of PnPjs library you are using

3.x

Minor Version Number

3.24.0

Target environment

All

Additional environment details

I'm writing a SharePoint WebPart using SPFx.

Question/Request

Apologies if this is a very basic question, but I can't see anything about it in the docs.

I have a list of users on my site (stored as an actual List, which is updated manually). When I retrieve the List using

const userList: any[] = await sp.web.lists
        .getByTitle("Users")
        .items.select("*", "User/Title", "User/EMail")
        .expand("User")();

I only seem to get 100 records back, although I have more than 100 records in my List. Is this a limit which is imposed by default? If so, can I change it so that it returns all records? Thanks.

juliemturner commented 4 weeks ago

By default the api returns 100 items, to change the number that are returned, use .top(x)... x can be 1 -> 5000. If you need more than 5000 you have to use paged Iterator and that is in the docs.

juliemturner commented 2 weeks ago

I'm going to close this issue as answered. If you have further issues, please feel free to create a new issue and reference this one.

github-actions[bot] commented 2 weeks ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.