Changing default link sharing type for Teams channels in Microsoft 365
When you wish to change the default link sharing type for Teams channels in Office/Microsoft 365, the SharePoint admin interface is lacking the options to configure for this. This is now also mentioned in the SharePoint documentation since this GitHub PR, but the updated SP documentation does not go into detail on the exacts steps to take. To bridge the gap, this post will provide a script that you can use.
The following code will solve this problem by looping through all SharePoint sites and setting the default link sharing option to “people with existing access”, which was my use case. You can tweak the script to your requirements.
$admin_site_url = "https://<YOUR_SITE>.sharepoint.com" Connect-SPOService -Url $admin_site_url $site_collections = Get-SPOSite -Limit All Foreach ($site in $site_collections) { Write-Host $site.Url Set-SPOSite -identity $site.Url -DefaultLinkToExistingAccess $true }