Skip to content

Instantly share code, notes, and snippets.

@mardahl
Last active May 5, 2020 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/dc40e37c44cb0217bc25204a19b5a1b0 to your computer and use it in GitHub Desktop.
Save mardahl/dc40e37c44cb0217bc25204a19b5a1b0 to your computer and use it in GitHub Desktop.
Enable anyone links on Teams and Office365 groups
# As a default, sharing links with anyone is disabled on Office 365 groupSites, which in turn also means Microsoft Teams Sites.
# Even if you have Anyone sharing enabled at the tenant level!
# This script can help y remove that requirement from a specific site.
# MIT licensing, keep author credits if reusing
# Author: Michael Mardahl @michael_mardahl on twitter
# https://github.com/mardahl
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
ipmo Microsoft.Online.SharePoint.PowerShell
$tenantName="contoso" #should be what comes before .onmicrosoft.com
Connect-SPOService -Url https://$tenantName-admin.sharepoint.com
Write-Host "Now is time to select the sites you want to enable guest/anyone sharing on (ctrl can be ued to select mutiple)."
$sites = Get-SPOSite | Out-GridView -PassThru
#now enabling the creation of anyone links
foreach ($site in $sites){
$site | Set-SPOSite -SharingCapability ExternalUserAndGuestSharing
}
Write-Host "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment