question

MudgalKritika-5573 avatar image
0 Votes"
MudgalKritika-5573 asked Danstan-MSFT answered

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

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

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you show the different sizes that you get? I am able to see almost same values with tiny byte differences that I attribute to file system differences and value loss or gain in math. For example my documents folder on OneDrive for business has 109.624.. MB on Graph API while on OneDrive Storage metrics it has 109.8 MBs

0 Votes 0 ·

Hi Danstan,

On summing the individual file size (obtained through https://graph.microsoft.com/v1.0/me/drive/root/children endpoint), I get the size as 287.363523 MB. On the other hand, the size of Documents folder in Storage Metrics shows as 365.6 MB.

Could you please let me know the API or the method which I shall you the calculate the Document folders size through Graph API.

Thanks


0 Votes 0 ·

1 Answer

Danstan-MSFT avatar image
0 Votes"
Danstan-MSFT answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.