Forum Discussion
File Type Aggregation
There isn't a specific API call that does this Our of the Box. There are a couple of potential approaches depending on if you need hard numbers or just estimates.
If a rough estimate is OK, then I would suggest setting up a search scope that only searches OneDrive locations and then you can use file type as a filter and get a rough count. It won't be perfect, but it should give you an order of magnitude for the tenant.
Another approach would be to write some PowerShell to walk the Documents DocLib in each users OneDrive and then count the totals by file extension. This will be slow, but accurate. I wrote up a set of PowerShell that will pull the usage of all user's OneDrive for Business. What you would need to do is change the Function GetODUsage to walk the files in the Documents and Total by File Type. Here is the link to the article where I talk about how to pull all of the OneDrive usage http://blogs.catapultsystems.com/dbroussard/archive/2015/10/20/pull-onedrive-for-business-usage-using-powershell/
I found an article where a person has the code to pull all files in a DocLib and write out their names. You should be able to make just a small change to pull counts instead. Here is that link: https://www.morgantechspace.com/2017/06/get-all-list-items-in-library-using-powershell.html
If you use my code to get the URLs for everyone, then use this block to open it using CSOM then you should be able to get everything that you need.