Closed alxjtlTE closed 2 years ago
Does the account you're signed into PowerShell with have admin access to SharePoint Online?
thanks for your reply, I really appreciate that. yes, I've tried it in two tenants. A german tenant with the german localization in the script and with an SharePoint and Teams Admin and in an english Demo tenant with global Admin and the standard "shared documents"-path . Same issue. Just ran the script again in the demo tenant and double checked my roles and even access to SharePoint admin center.
The SPO usage data is fetched using the Graph query:
$SPOUsageReportsURI = "https://graph.microsoft.com/v1.0/reports/getSharePointSiteUsageDetail(period='D90')" $SPOUsage = (Invoke-RestMethod -Uri $SPOUsageReportsURI -Headers $Headers -Method Get -ContentType "application/json") -Replace "...Report Refresh Date", "Report Refresh Date" | ConvertFrom-Csv
If you execute these commands, do you get data in $SPOUsage?
if I add "Write-Host $SPOUsage" at the end of the script I see some data for "File Count", "Storage Used" and "Last Activity Date".
It looks like you are obfuscating data, which means that the display name of the sites aren't showing. In turn, this means that the lookup into the hash table for the real site names (retrieved from the group details) doesn't work., so you don't see any info.
This post explains how the Graph obfuscates user and site data. https://office365itpros.com/2021/04/16/microsoft-obfuscates-teams-usage-data/
wow, that was it! Thank you, you were super helpful. You are a true MVP!
Hi, I don't get "Last SPO Activity" (-> empty), "SPO Storage Used (GB)" (-> N/A) and "Numer SPO Files" (-> 0) from any group. I don't get any errors running the script. Already checked Graph permissions and library localization. Everything else seems to be there and correct. What could be wrong? Thanks in advance.