SharePoint Online PowerShell Exposes New Properties to Identify Teams-Connected Sites


July 12, Microsoft released version 16.0.21411.1200 of the SharePoint Online PowerShell module, installable from the PowerShell Gallery. The updated module is especially notable because the Get-SPOSite cmdlet boasts three new properties to inform administrators if sites are connected to Teams. The properties are:

  • IsTeamsConnected: Set to True if the site is connected to a team.
  • IsTeamsChannelConnected: Set to True if the site is connected to a Teams private or shared channel. These sites have IsTeamsConnected set to False.
  • TeamsChannelType: Set to None for teams-connected sites and to Private for sites belonging to private channels or Shared for sites belonging to shared channels (due later this year).

New View of Teams Sites

The updated module aligns with the effort to make SharePoint Online more manageable for teams-connected sites through a UI refresh and by showing details of channel-connected sites in the SharePoint Online admin center with a new Sites connected to Teams view (Figure 1). This view is in preview at present and should become generally available later this year.

Showing details of teams-connected sites in the SharePoint Online admin center
Figure 1: Showing details of teams-connected sites in the SharePoint Online admin center

The new view lists all teams-connected sites and indicates how many of the channels in a team have a channel-connected site. Clicking the link for the channel sites exposes further information (Figure 2).

Viewing details of a channel-connected site
Figure 2: Viewing details of a channel-connected site

The net effect of the change is that SharePoint administrators will see information about teams-connected and channel-connected sites in the SharePoint Online admin center which isn’t available today. Access to information about channel-connected sites is read-only. This is because these sites inherit settings from the parent team site. It also ensures that management of the channel-connected sites remains with the channel owners.

Using the New Teams Site Properties in PowerShell

Coming back to PowerShell, the new properties make it easier to find and report details of Teams-connected sites. You can still do this using the Get-UnifiedGroup cmdlet, which offers the advantage of exposing group information more easily. Now you have the option to check if team-connected sites have private or shared channels.

Here’s some quick and dirty PowerShell to report channel-connected sites. The code:

  • Creates an array of sites connected to Teams.
  • Creates another array of channel-connected sites.
  • Loops through the sites array to see if any matching channel-connected sites are present and reports these sites. Remember, a team can have up to 30 private channels.

# Find Teams-connected site
[array]$Sites = Get-SPOSite -Limit All | ? {$_.IsTeamsConnected -eq $True}
# Find channel connected sites
[array]$ChannelSites = Get-SPOSite -Limit All | ?{$_.IsTeamsChannelConnected -eq $True}

$SiteCount = 0
$ChannelData = [System.Collections.Generic.List[Object]]::new()
ForEach ($Site in $Sites) {
   [array]$MatchedSites = $ChannelSites | ? {$_.Url -Match $Site.Url}
   If ($MatchedSites) {
      ForEach ($MSite in $MatchedSites) {
       $ReportLine = [PSCustomObject][Ordered]@{  
         Parent      = $Site.URL
         Title       = $Site.Title
         URL         = $MSite.URL
         ChannelType = $MSite.TeamsChannelType }
      } # End ForEach
   } # End if
} # End Foreach
Write-Host ("Total of {0} channel-connected sites found for {1} sites" -f $ChannelData.Count, $SiteCount)

Here’s an example of a record for a channel-connected site:

Parent      :
Title       : Corporate Acquisition Planning 2020
URL         :
ChannelType : PrivateChannel

Figuring Out Inconsistencies

Interestingly, I found instances where the Microsoft 365 group which originally owned a team-connected site was no longer available in the tenant, but team-connected and channel-connected sites still existed. This is likely due to retention policies where sites come within the scope of a retention policy and the group did not. I used the following code to find these channel-connected sites:

# See if we can find parent groups
ForEach ($CSite in $ChannelSites) {
   $MatchURL = $CSite.URL.Split("-")[0]
   $Match = $Sites | ? {$_.Url -Match $MatchURL}
   If (!($Match)) {Write-Host "Can't find parent team-connected site for channel-connected"  $CSite.URL }

I also found some inconsistencies between the number of channel-connected sites reported using the new properties and the older method of using the site template to identity these sites:

$TTSites = Get-SPOSite -Limit All -Template "TEAMCHANNEL#0"

Some testing revealed that this is due to some provisioning delays in updating site properties. Essentially, if you update the membership of a channel, you force synchronization to update site properties.

Exposing Channel-Connected Sites

There’s no doubt that these updates add value. When Microsoft introduced private channels in November 2019, many complained that the sites used for sharing documents in private channels were invisible (they weren’t, but you had to use PowerShell to see them). Exposing details of private channels (and soon, shared channels) in the SharePoint Online admin center is a good thing: adding the properties to allow better filtering and reporting of channel-connected sites in PowerShell is even better.

Learn more about how Office 365 really works on an ongoing basis by subscribing to the Office 365 for IT Pros eBook. Our monthly updates keep subscribers informed about what’s important across the Office 365 ecosystem.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.