Retrieving Public Groups, SharePoint Sites, and Teams Integration

In the ever-evolving landscape of Office 365, administrators and IT professionals are continually seeking efficient ways to manage and oversee their environments. Central to this management is the ability to effectively track and organize Office 365 groups, their associated SharePoint sites, and their integration with Microsoft Teams. This article delves into how you can seamlessly obtain a list of all public Office 365 groups, retrieve their SharePoint site URLs, and ascertain their Teams integration status, empowering you to enhance your administrative workflow and collaboration efficiency.


Before diving into the technicalities, ensure you have the necessary tools and permissions. You will need administrative access to your Office 365 environment and PowerShell installed on your machine. Familiarity with the Microsoft Graph API can also be beneficial for more advanced operations.

Getting the List of Public Office 365 Groups using PowerShell

PowerShell is a powerful tool for managing Office 365 groups. Begin by installing and configuring the Entra ID or Microsoft Graph PowerShell SDK. Once set up, you can use the following script to list all public Office 365 groups:

Get-AzureADGroup -Filter "groupTypes/any(c:c eq 'Unified') and visibility eq 'Public'" | Select-Object DisplayName, ObjectId

This command connects you to Azure AD and fetches all public unified groups, displaying their names and object IDs.

Retrieving SharePoint Site URLs for Each Group

Every Office 365 group comes with a SharePoint site, which serves as a collaborative space for group members. To fetch the SharePoint site URL for each public group, use the following script:

$groups = Get-AzureADGroup -Filter "groupTypes/any(c:c eq 'Unified') and visibility eq 'Public'"
foreach ($group in $groups) {
    $site = Get-SPOSite -Identity "https://<YourTenantName>$($group.DisplayName)"
    Write-Output "Group: $($group.DisplayName), Site URL: $($site.Url)"

Replace <YourTenantName> with your actual tenant name to obtain the site URLs.

Determining if a Group has Teams Integration

To check whether a public Office 365 group has an associated Microsoft Teams instance, use the following script:

$groups = Get-AzureADGroup -Filter "groupTypes/any(c:c eq 'Unified') and visibility eq 'Public'"
foreach ($group in $groups) {
    $team = Get-Team -GroupId $group.ObjectId
    if ($team) {
        Write-Output "Group: $($group.DisplayName) has Teams integration."
    } else {
        Write-Output "Group: $($group.DisplayName) does not have Teams integration."

This script identifies which groups are connected to Teams, providing a clear view of the collaboration landscape within your organization.


Efficient management of Office 365 groups, SharePoint sites, and Teams integration is crucial for maintaining a productive and well-organized digital workplace. The PowerShell scripts provided in this article are designed to streamline the process of monitoring and managing these components, offering clear insights and control over your Office 365 environment.