Nov 16 2018 03:42 AM
Nov 16 2018 03:42 AM
This is a general question hoping in getting ideas/guidance. Part of our business or user based asked if there is a way to somehow aggregate the document file type that is stored in OneDrives. In other words our clients are looking to find out how many excel files, pdf files, onenote files, etc are being hosted on OneDrives. The are some good out of the box reports in the tenant admin center for OneDrive showing metrics like number of files, active files, storage used etc.
To get the aggregated count of file types, is this something that could potentially be captured through an API or would we need for example in creating columns that can capture file type details so that we can then get a count doing this programmatically. Thank you!
Nov 18 2018 10:40 PM
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-usin...
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.
Nov 19 2018 08:05 AM
Are you looking for a solution to analyse multiple OneDrive for Business libraries or do you want individual users to be able to generate such a report for their own environment only?
Paul | SLIM Applications
Nov 19 2018 10:58 AM
Thank you all for the feeback, I really appreciate it. The goal would be in targeting several OneDrives (a slice covering one division not for the whole company).