Hello Federico Coppola,
Thanks for reaching out!
I agree with @Patchfox on this. Some queries against Microsoft Graph return multiple pages of data either due to server-side paging or due to the use of the $top
query parameter to specifically limit the page size in a request. When more than one query request is required to retrieve all the results, Microsoft Graph returns an @odata.nextLink
property in the response that contains a URL to the next page of results. Further reading on Paging-MS graph.
Note that the script is currently configured to retrieve only the first 5 users by setting the $top
parameter to 5 in the initial Graph API request. This value can be adjusted as needed to retrieve more or fewer users.
Refer below documentation to know how to use query parameters to control the amount of data in response:
https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.