Skip to content
Advertisement

How to use the Pagination in Microsoft Graph API

I would like to be able to retrieve all users in my Azure Active Directory and cache it so I could filter my users on demande. I know about the nextLink used for Pagination. I’m fairly new in the React world and Javascript so I need some help understanding how to cycle through all pages to get all my users. Here’s the code I have right now :

JavaScript

I was able to access the nextLink url using the [“@odata.nextLink”]. So my question is how to get all users ? Do I just loop until nextLink is null or there is a better way.

Thank you

Advertisement

Answer

Here’s the code to be able to get all pages of data from a Microsoft Graph :

JavaScript

That works wonders!

Thank you all for the help

Advertisement