The Graph API limits the number of records returned in a single request. Even if you specify $top=999
, you might not get all the records in a single response. You need to handle pagination to retrieve all the records.
The API will return a @odata.nextLink
property if there are more records to retrieve. You should use this link to request the next page of records.
Using ConsistencyLevel=eventual
and $count=true
helps in scenarios where you want to get the total number of records. However, this setting might still limit the number of records returned per page.
Here is what you need to do :
In your pipeline, use a Copy Data
activity to connect to the Microsoft Graph API using the linked service you've already set up.
In the Copy Data
activity, ensure that pagination is configured correctly.
Add a dynamic dataset that handles the @odata.nextLink
for fetching subsequent pages. You can achieve this using ADF's built-in pagination support by setting the pagination rule in the dataset or activity.
If the built-in pagination does not work as expected, consider using a loop with a ForEach
activity to loop through each page of data until no more @odata.nextLink
is returned.
Adjust the $top
value to something smaller, such as 100, to better handle API limits. Use $skip
if you need to skip a certain number of records.