pnp / pnpjs

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

MS Graph Following Endpoint limited to 10 items #3067

Closed JamesDerrickHH closed 2 weeks ago

JamesDerrickHH commented 3 weeks ago

What version of PnPjs library you are using

4.x

Minor Version Number

4.0.1

Target environment

SharePoint Framework

Additional environment details

Building a sharepoint webpart (1.19), created by yeoman, and using the React framework (v17)

Question/Request

I am building a sharepoint webpart that gets a list of a user's followed items, to display a star icon next to them I have successfully retrieved items but the endpoint seems to be limited to 10 items maximum My approach is to get a user's default drive And then use that to get the followed items

      const defaultDrive = await graph.me.drive();
      const driveItems: FaveDriveItem[] = await graph.me.drives.getById(defaultDrive.id ?? '').following()

Is there any way to retrieve more items? Or a different approach I can use? Thanks

bcameron1231 commented 3 weeks ago

Hi. yes there is a way to retrieve more items by using the top() method. See below.

const defaultDrive = await graph.me.drive();
const driveItems = await graph.me.drives.getById(defaultDrive.id ?? '').following.top(50)();
bcameron1231 commented 2 weeks ago

Closing this issue as answered. If you have additional questions or we did not answer your question, please open a new issue, ref this issue, and provide any additional details available. Thank you!

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.