Find All Office 365 Group Sites in SharePoint Online

Requirement: Get All Group Sites in SharePoint Online.

How to find all group-connected team sites in SharePoint Online?

The new SharePoint Online admin center lists all group sites and modern sites. You can log in to SharePoint Online Admin Center >> Click on “Active Sites” and then look for the “Primary Admin” Column which has “Group Admin” to get the list of all SharePoint Online group site collections.

find all group sites in sharepoint online

SharePoint Online: List Group Sites using PowerShell

We can filter site collections based on its template to get group enabled sites. Run these lines of PowerShell script in SharePoint Online Management Shell.

#Set Admin Center URL
$AdminCenterURL = ""

#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)

#Get All Group Sites
Get-SPOSite | Where { $_.Template -like 'GROUP*'} | Select URL

This gets you the list of all group sites!

Get All Group Sites in SharePoint Online and Export to CSV:

Gets get a list of group sites and export the data to CSV file from SharePoint side.

#Set Admin Center URL
$AdminCenterURL = ""

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

#Get All Group Sites
$GroupSites = Get-SPOSite -Limit All -Template 'GROUP#0' -IncludePersonalSite:$False
Write-host "Total Number of Group Sites Found:"$GroupSites.count

$SiteData = @()
#Loop throgh each site
ForEach($Site in $GroupSites)
    #Get Group Site Data
    $SiteData += New-Object PSObject -Property @{
                'Site Title' = $Site.Title
                'URL' = $Site.Url
                'Last Modified' = $Site.LastContentModifiedDate
                'StorageUsed' = $Site.StorageUsageCurrent              
#Export the data to CSV
$SiteData | Export-Csv $ReportOutput -NoTypeInformation
Write-Host -f Green "Group Sites Data Exported to CSV!"

and the script output report:

sharepoint online list group sites

How to Get the Office 365 Group of a SharePoint Site?

$SiteURL = ""

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri `
    -Credential (Get-Credential) -Authentication Basic -AllowRedirection

Import-PSSession $Session

#Find the Office 365 group using the SharePoint site URL
$Group = Get-UnifiedGroup -ResultSize Unlimited | Where { $_.SharePointSiteUrl -eq $SiteURL}
Write-host $Group.Guid

Get Group Sites using Exchange Online PowerShell

Let’s get all Office 365 groups and their associated sites using Exchange Online PowerShell.

#Get Credentials to connect
$Credential = Get-Credential
#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri `
           -Credential $Credential -Authentication Basic -AllowRedirection
#Import the session
Import-PSSession $Session -DisableNameChecking

#Get All Office 365 Groups
$Groups = Get-UnifiedGroup -ResultSize Unlimited -SortBy Name
        $GroupSites = @()
        $Groups | Foreach-Object {
            $Group = $_
            $SiteURL = $Group.SharePointSiteUrl
            If($SiteURL -ne $null){
                $GroupSites += New-Object -TypeName PSObject -Property @{
                      GroupName = $Group.Alias
                      GroupUrl = $SiteURL
                      EmailAddress = $Group.EmailAddress
                      DisplayName = $Group.DisplayName
                      Privacy = $Group.AccessType
                      Owners = $Group.ManagedBy
                      Created = $Group.WhenCreated
                      Changed = $Group.WhenChanged
#Remove the session
Remove-PSSession $Session

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply