The activity reports available for Microsoft 365 groups and Teams can be beneficial for administrators in an organization. Microsoft 365 teams group activity reports provide insight into group activities, group workloads, group counts, storage, and file counts. The reports can help admins identify inactive groups and teams.
The activity reports for groups and teams provide insight into the activity of groups and teams in the organization. It is possible for administrators to see how many Microsoft 365 groups and teams there are and how they are being used.The Microsoft 365 group reports can provide comprehensive information about:
Sharepoint site files and storage quota used by the group
For team-enabled groups, the number of conversations in channels
Conversations in the inbox of the group
Below is the step-by-step guide on getting activity reports for Microsoft 365 groups and teams using PowerShell.
$uri = "https://graph.microsoft.com/v1.0/groups?`$filter=groupTypes/any(a:a eq 'unified')"
[array]$Groups = Get-GraphData -AccessToken $Token -Uri $uri
If (!($Groups)) {Write-Host "Can't find any Microsoft 365 Groups - Check your access token"; break}
$i = 0
$GroupsList = [System.Collections.Generic.List[Object]]::new()
ForEach ($Group in $Groups) {
$i++
Write-Host ("Processing group {0} {1}/{2}" -f $Group.DisplayName, $i, $Groups.Count)
$GroupOwnerEmail = $Null; $OwnerNames = $Null
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/owners?"
[array]$GroupData = Get-GraphData -Uri $Uri -AccessToken $Token
If ($GroupData[0].'@odata.type' -eq '#microsoft.graph.user') {
# Extract owner names of groups
$OwnerNames = $GroupData.DisplayName -join ", "
$GroupOwnerEmail = $GroupData[0].Mail }
Else { # ownerless group
$OwnerNames = "No owners found"
$GroupOwnerEMail = $Null }
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "?`$select=visibility,description,assignedlabels"
$GroupData = Get-GraphData -AccessToken $Token -Uri $uri
$Visibility = $GroupData.Visibility
$Description = $GroupData.Description
$GroupLabel = $GroupData.AssignedLabels.DisplayName
$SPOUrl = $Null; $SPODocLib = $Null; $SPOQuotaUsed = 0; $SPOLastDateActivity = $Null
$Uri = "https://graph.microsoft.com/v1.0/groups/" + $Group.Id + "/drive"
[array]$SPOData = Get-GraphData -AccessToken $Token -Uri $uri
[int]$LLVValue = $SPOData.WebUrl.IndexOf($SharedDocFolder)
If (($SPOData.id) -and ($SPOData.DriveType -eq "documentLibrary")) {
If ($LLVValue -gt 0) {
$SPOUrl = $SPOData.WebUrl.SubString(0,$SPOData.WebUrl.IndexOf($SharedDocFolder))
$SPODocLib = $SPOUrl + $SharedDocFolder2
$SPOQuotaUsed = [Math]::Round($SPOData.quota.used/1Gb,2)
$SPOLastDateActivity = Get-Date ($SPOData.lastModifiedDateTime) -format g
}
Else {
$SPOUrl = $SPOData.WebUrl
$SPODocLib = $SPOUrl + $SharedDocFolder2
$SPOQuotaUsed = [Math]::Round($SPOData.quota.used/1Gb,2)
$SPOLastDateActivity = Get-Date ($SPOData.lastModifiedDateTime) -format g
}
}
Else {
CLS; Write-Host "Continuing to fetch information about Microsoft 365 Groups..."
$Uri = "https://graph.microsoft.com/beta/groups/" + $Group.Id + "/Members/Microsoft.Graph.User/`$count?`$filter=UserType eq 'Guest'"
$GuestMemberCount = Get-GraphData -AccessToken $Token -Uri $uri
$Uri = "https://graph.microsoft.com/beta/groups/" + $Group.Id + "/Members/Microsoft.Graph.User/`$count?`$filter=UserType eq 'Member'"
$GroupMemberCount = Get-GraphData -AccessToken $Token -Uri $uri
Step 6: Update the list with group information collected with the previous scripts
$ReportLine = [PSCustomObject][Ordered]@{
DisplayName = $Group.DisplayName
ObjectId = $Group.Id
ManagedBy = $OwnerNames
GroupContact = $GroupOwnerEmail
GroupMembers = $GroupMemberCount
GuestMembers = $GuestMemberCount
SharePointURL = $SPOUrl
SharePointDocLib = $SPODocLib
LastSPOActivity = $SPOLastDateActivity
WhenCreated = Get-Date ($Group.createdDateTime) -format g
WhenRenewed = Get-Date ($Group.renewedDateTime) -format g
Visibility = $Visibility
Description = $Description
Label = $GroupLabel }
$GroupsList.Add($ReportLine)
}
$GroupsList = $GroupsList | Sort DisplayName
$uri = "https://graph.microsoft.com/V1.0/groups?`$filter=resourceProvisioningOptions/Any(x:x eq 'Team')"
[array]$Teams = Get-GraphData -AccessToken $Token -Uri $uri
$TeamsHash = @{}
$Teams.ForEach( {
$TeamsHash.Add($_.Id, $_.DisplayName) } )
Step 8: List of all groups and teams found
$TeamsCount = $Teams.Count
$GroupsCount = $GroupsList.Count
If (!$GroupsCount) {Write-Host "No Microsoft 365 Groups can be found - exiting"; break}
If (!$TeamsCount) {Write-Host "No Microsoft Teams found in the tenant - continuing..." }
$S2 = Get-Date # End of fetching
CLS
Write-Host "Fetching data for" $GroupsCount "Microsoft 365 Groups took" ($S2 - $S1).TotalSeconds "seconds"
$Report = [System.Collections.Generic.List[Object]]::new(); $ReportFile = "c:\temp\GroupsActivityReport.html"
The reports dashboard in Microsoft 365 shows the activity overview across the products in the organization. The reports can be accessed by global admins, teams service admins, and global readers. These reports enable the admins to get insights within each product. Admins can view the user activity reports, last activity reports Below is the step-by-step guide to access reports in the admin center in Microsoft 365.
iii) You can view the activations in the Office 365 report by choosing the Group Activities tab.iv) You can also export the report data into an excel or .csv file by selecting the Export link. This exported data of all users enables admins to do simple sorting and filtering for further analysis.