How to get Document folder's total size(as per Storage Metrics) in OneDrive using Microsoft Graph API ?

Mudgal, Kritika 11 Reputation points
2021-03-17T19:58:59.613+00:00

Hi Team,

I need to get total size of Documents folder in OneDrive. I can get the same, manually, by going to 'Storage Metrics' of OneDrive. However, I need to get the same using Microsoft Graph API.

But, the sum of size of individual items returned by calling Graph API to get content of Root folder, does not match with the size of Documents folder given in Storage Metrics.

API endpoint used - https://graph.microsoft.com/v1.0/me/drive/root/children

Could you please help with the aforementioned issue?

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,715 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Danstan Onyango 3,741 Reputation points Microsoft Employee
    2021-03-22T07:57:15.14+00:00

    I don't see the behavior you are experiencing. The sum of files in my root drive match the size of files indicated on storage metrics. I suggest you try GET https://graph.microsoft.com/v1.0/me/drive/root to see if the size property matches the metrics. Then try the same thing for the child that has different size on your end.

    0 comments No comments