How to enable the parent link for Onenote Class Notebook build in Teams via powershell

Couple weeks ago I post an article about how to enable the parent link for Teams class notebook and the method I mention is we need to open the link one by one which will cost lots of time for IT. You can check the previous post from the link below:

I did lots of the searching and ask help from MS these days and finally found a way to enable the link via powershell. It will save lots of your time but as this is not the official method, so please test it first before you roll it out and it works for AISG.

First of all, you need to go the link below and install the powershell module.

Double click the install the package then click “Next”.

Click “Finish”.

Run the SharePoint online powershell as the administrator.

Run the following command to manage your tenant with your SharePoint admin account.

$adminUPN=”SharePoint Admin email account”

Run the following command to login with your tenant.

$userCredential = Get-Credential -UserName $adminUPN -Message “Password for the SharePoint Admin account”.

Login with your account again.

Run the following command to login to your tenant’s sharepoint page

Connect-SPOService -Url https://”Your domain name” -Credential $userCredential

Run the following command and you don’t need to change anything so that to enable the parent link for the notebook.

$sites = Get-SPOSite -Limit All


foreach($site in $sites)


$siteURL = $site.Url

Write-Host $siteURL -ForegroundColor Cyan

Set-SPOSite -Identity $siteURL -SharingCapability ExternalUserAndGuestSharing



Please make sure don’t close this windows until it deploy the policy to all groups and Teams. It will take a while depends on how many site you have for your tenant. After they powershell finish to deploy, you can enable the parent link again.


  1. This powershell only can change the setting for all existing sites, so if you have any new sites created after we run the powershell, then please run the command again.
  2. This command not only can used for enable the parent link for Onenote Class notebook but also can used for enable the anyone sharing when you share the file from Teams or groups. As the default policy for Teams or groups file sharing is not allow to share the file to anyone.