Private Channels gives the ability to restrict the membership further within a Team site. A person can create a private channel, like creating a public channel, except they can add owners/members to the channel from a subset of members from the Team site.
When a private channel is created, what is happening under the covers is a creation of another SharePoint site. A cut down version of a SharePoint site, using the Template TEAMCHANNEL#0. (ID: 69 for those that want to know)
As this is my first blog post about Private Channels, let me demonstrate quickly how to create a Private Channel.
How to add a private channel
- From MS Teams click on the ellipse next to your Team name, and select Add Channel.
- Give the channel a name, optional description, and select “Private – Only accessible to a specific group of people within the team”
- Click Next. On the next page you can add people from the Team to have access to the Private Channel. They can be an Owner of the channel even if they are only a member within the Team.
- The private channel will show up as a channel underneath your team, with a pad lock next to it, indicating that it is a private site. You will only see this channel if you are a owner/member of the channel.
- The SharePoint site – which you can get to by clicking on files Open in SharePoint – has the URL made up of https://<tenant>.sharepoint.com/sites/<TeamName>-<ChannelName> and the home page of the site is the root of the Shared Document library.
Finding the related site
There are a couple of places I have found out where to get the related site.
Property Bag and Graph API
When I did a PNP Get-ProvisioningTemplate pointing at a private channel site, I discovered in the property bag there is a value called RelatedGroupId and it is Indexed.
<pnp:PropertyBagEntry Key=“RelatedGroupId” Value=“d99aa865-cd55-46cc-b256-177975ad3e13” Overwrite=“false” Indexed=“true” />
With this value you can then get the SharePoint site of the MS Team using Graph API
Note: On the parent Team site, there is a property bag value called GroupId. It also has RelatedGroupId, which has the same value.
CSOM using the Site object
The related GroupID can also be obtained in CSOM via the Site object.
Site site = context.Site; context.Load(site, s => s.RelatedGroupId); context.ExecuteQueryRetry();
Showing all the private channels from the main SharePoint site
When I used PNP to obtain the Private Channel template and discovered the RelatedGroupId was in the property bag and that it was indexed, means that it is searchable. If you check the Manage Search Schema, you will find the managed property.
This means doing a simple search like below, will return all the private channel sites.
Using the Microsoft Search PnP Modern Search SPFX (https://github.com/microsoft-search/pnp-modern-search/releases/tag/3.8.0), very quickly I was able to display links.
For someone who only has access to one of the Private Channels, they will only see one in search.