using microsoft graph to get versioning infomation

Ian.Mahern-Macias 0 Reputation points

I am currently working to try and use Microsoft graph to reliable report to me the size of a file, the total number of versions for that file, and the total space that all the versions combined take up for all files for a site/site collection

I am reviewing a lot of the QA questions here and I cannot seem to find anyone trying to do something similar with this tool.
I know there are powershell script for this but due to the size of some of our site collections it takes a very long to run this and I believe that the graph API should be quicker.

does anyone have any starting advice? is this something the Microsoft Graph can do?

Thank you

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

1 answer

Sort by: Most helpful
  1. CharanyaB-MSFT 1,501 Reputation points Microsoft Vendor

    Hello @Ian.Mahern-Macias,

    Thanks for reaching out!

    You can use GET /sites/{site-id}/drive/items/{item-id}/versions API to fetch the versions of OneDrive or SharePoint items. This API lists all versions and gives the size of each version. But currently, this doesn't fetch the total space of all the versions combined. Please refer to the below documents for more details about fetching the versions of an item using Graph API:

    Hope this helps.

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

    0 comments No comments