Hello everyone, I am creating a workflow for obtain Users from Microsoft graph.
For obtain users there is this endpoint: https://graph.microsoft.com/v1.0/users
And the limit is 999 contacts each request.
My database is 5k ish, and It’s growing, so we can say we don’t have a fixed number.
The pagination in Microsoft Graph works with a page.link, that it’s provided in the first request you do.
Then you need to use this link for scroll the page and search.
What is the error message (if any)?
There is no error, but I need to find a proper way to scroll all the users I am obtaining from the first request.
My idea was to obtain every time the
{{ $(‘Get Users’).item.json[“value”].length }} (number of users obtained from the call)
and compare with
{{ $(‘Get Users’).item.json[“@odata.count”] }} (number of all the users)
Do you have any idea?
Let me know if you need anythings
Hi @Gabriele_Bracciali, you can start with this part. It should fetch all users, no other HTTP Request nodes needed
It does this using this expression: {{ $json['@odata.nextLink'] || "https://graph.microsoft.com/v1.0/users?$top=10&$count=true" }}
When @odata.nextLink is available it’d use that URL, but when not (so on the very first run), it’d go with https://graph.microsoft.com/v1.0/users?$top=10&$count=true instead. This is called short-circuiting.
I’ve removed your original filter in my example though as your filter wouldn’t match any of my users. So you probably want to add this piece back in.