12Knocksinna / Office365itpros

Office 365 for IT Pros PowerShell examples
MIT License
1.28k stars 567 forks source link

No SPO data #43

Closed alxjtlTE closed 2 years ago

alxjtlTE commented 2 years ago

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.

12Knocksinna commented 2 years ago

Does the account you're signed into PowerShell with have admin access to SharePoint Online?

alxjtlTE commented 2 years ago

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.

12Knocksinna commented 2 years ago

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?

alxjtlTE commented 2 years ago

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". teams_activity_script_issue1

12Knocksinna commented 2 years ago

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/

alxjtlTE commented 2 years ago

wow, that was it! Thank you, you were super helpful. You are a true MVP!