Microsoft Graph API to scan my organizations OneDrive take very long time.

Allagadda Sai Upendranath 0 Reputation points

I am using Microsoft Graph API to scan permissions of resources in my organization OneDrive. It contains almost 20 million objects. It takes many days to completely retrieve info on permissions. Can you please suggest how I can optimize or is there any other way to do this quicker?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,890 questions
A Microsoft file hosting and synchronization service.
715 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Diah.Karim-MSFT 320 Reputation points Microsoft Vendor

    Hi Allagadda,

    I believed you are using one of the endpoint as below link to loop through the list of permissions info for each files, right? Potentially this endpoint /sites/{siteId}/drive/items/{itemId}/permissions

    There are couple of approaches that can be done to improve the performance of getting info about permission for each item.

    1. Query Parameters - This will help you achieve multiple tasks such as limiting the amount of data returned by requests to Microsoft Graph such as controlling how many fields are returned for each record, how many records are returned, also filtering and searching for wanted information.
    2. Reduce traffic with batched requests - Use batch requests Microsoft Graph to execute multiple requests and return the grouped results for each request in a single response. Batching doesn't reduce the number of requests, but it does reduce the number of HTTP round trips your application requests to Microsoft Graph.

    More details refer to this link

    More info regarding batches request - Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments