Thursday 5 September 2019

Office Reporting API


Problem

Working with a customer moving from one tenant to another. Two distinct groups of users and one of the challanges has been in getting data on OneDrive, OneNote usage and client usage.We have not found decent information on the usage of OneDrive or OneNote, so moving 5K users is challanging. OneDrive has two statistics that MS publish, Total Files and Active Files. We have found that total files is different in OneDrive from the report is different to the count on a local copy. Have no infor on why this is different.
The PowerBI or Office 365 report for OneDrive will give you the number in Sharepoint.
The following query in PowerShell on your local OneDrive location, assuming all files are synched, will tell you how many files you have.
     
    dir *.* -recurse | measure-object


The Data Source

Based on access to MS O365 usage report on PowerBI.
Enable O365 reporting as per the Microsoft document Link

The file on Customize the reports in Microsoft 365 usage analytics Link is faulty. I've reported this, so a copy is available here 

Tenant ID found in Azure AD    _Tenant_ID_
Account for the user that enabled O365 reporting        admin@_Tenant_Name_.onmicrosoft.com


Shared link for the PowerBI portal

Office 365 Reports in the admin center - OneDrive for Business usage
The PowerBI Desktip pbit file is in the files section, password is please

If a PowerBI app fails to load data. Delete it and re-add.
PowerBI Desktop will save the creds you used to connect to the PowerBI portal.

 Fig 1 – PowerBI Desktop



To make use of the PowerBI report, edit the query to get at the data/ API.

Fig 2 – PowerBI Desktop



Fig 3 – PowerBI Desktop

Copy out the code
let
    Source = OData.Feed("https://reports.office.com/pbi/v1.0/" & TenantID,null,[ODataVersion=4]),
    TenantMailboxUsage_table = Source{[Name="TenantMailboxUsage",Signature="table"]}[Data]
in
    TenantMailboxUsage_table
Then to edit we take the api piece and add in the tenant ID and then the content we want to report on
Source = OData.Feed("https://reports.office.com/pbi/v1.0/" & TenantID,null,[ODataVersion=4]),
    TenantMailboxUsage_table = Source{[Name="TenantMailboxUsage",Signature="table"]}[Data]

We will use
https://reports.office.com/pbi/v1.0/ Tenant ID to be added /TenantMailboxUsage

Giving us


Fig 4 – Report 01


Tenant OneDriveUsage is as follows:



Fig 5 – PowerBI Desktop

let
    Source = OData.Feed("https://reports.office.com/pbi/v1.0/" & TenantID,null,[ODataVersion=4]),
    TenantOneDriveUsage_table = Source{[Name="TenantOneDriveUsage",Signature="table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(TenantOneDriveUsage_table,{{"DiskQuota", Int64.Type}})
in
    #"Changed Type"

All tenant reports

Other reports available


What Clients are being used, limited data.
Aggregated mailboxes in O365
O365 group activity per month over the last 12 months as a monthly stat
Monthly total office activations
OneDrive activity per month over the last 12 months as a monthly stat
Seems to show the total activity per month over the last 12 months as a monthly stat
Seems to show the total product activity per month over the last 12 months as a stat
SharePoint activity per month over the last 12 months as a monthly stat
User overall activity per month over the last 12 months as a monthly stat. Is this the important one?
User information