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 = "https://crescent-admin.sharepoint.com/"

#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:

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

#Set Admin Center URL
$AdminCenterURL = "https://crescent-admin.sharepoint.com/"
$ReportOutput="C:\Temp\GroupSites.csv"

#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 = "https://crescentintranet.sharepoint.com/sites/Legal"

#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False

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

#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

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
 
#Connect to Exchange Online
Connect-ExchangeOnline -Credential $Credential -ShowBanner:$False

#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
                }
            }
        }
        $GroupSites

#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

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