Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

OneDrive storage usage

(0) ShareShare
ReportReport
Posted on by 463

Hello!

 

Is there a way to use Power Automate to check a users license type and then generate a list of who has it and their onedrive storage capacity?  I want the output in a way that I can use the email addresses of those listed to send emails to (if need be).

 

Thanks!

Rebecca

  • Verified answer
    Expiscornovus Profile Picture
    32,140 Most Valuable Professional on at
    Re: OneDrive storage usage

    Hi @RMD211,

     

    You can use the getOneDriveUsageAccountDetail method from the Graph API to retrieve a csv report with the OneDrive sites and their capacity based on the last 180 days of usage (you can also use different time ranges like D7 or D30).

    https://learn.microsoft.com/en-us/graph/api/reportroot-getonedriveusageaccountdetail?view=graph-rest-1.0&tabs=http

     

    You can use a Select action to convert that csv into an array and only retrieve the 11th column of that csv, which is the email address of the OneDrive for Business site owner. 

     

    @ManishSolanki has shared a nice approach on how to use a chunk function for this csv to array conversion.

    https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/How-to-convert-CSV-file-to-array-of-JSON-objects/ba-p/2437514

     

    Below is an example

     

    1. HTTP action one requests the report (based on the last 180 days) and will get an Redirect response back with the download location of the csv report file. This action requires authentication (I used an app registration in Entra Id with the Reports.Read.All Graph API permissions).

    https://graph.microsoft.com/v1.0/reports/getOneDriveUsageAccountDetail(period='D180')

     

    2. HTTP action two only runs on has failed status (302 Redirect is a failed status). You can set this up via the Configure run after in the settings of this action. The uri is the location value from the response header of the first action, you can use this expression for that.

    outputs('HTTP_-_getOneDriveUsageAccountDetail')['headers']['location']

     

    3. The Select uses the below expression with the chunk function in the From

    skip(chunk(split(replace(base64ToString(body('HTTP_-_CSV_file_from_Redirect')['$content']), decodeUriComponent('%0A'),','),','),12), 1)

     

    4. The map field is switched to text mode (single column) with the T button on the right side. It only uses column 11 (User Principal Name), which is index 10

    item()?[10]

     

    getonedrviveusageaccountdetail_method.png

     

     

    After that you can do whatever you want with that array. For example with a join function you could use it in a To field of a Send an Email (v2) action:

    join(body('Select_-_Owner_Principal_Name_of_each_OneDrive_site'), ';')

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1