Created
August 19, 2019 12:26
-
-
Save westerdaled/d32c8184e14f4b448cb40472d792f4c2 to your computer and use it in GitHub Desktop.
Enable External Sharing on a SharePoint Online Site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$tenant = "yourTenant" | |
$tenantUrl = "https://{0}.sharepoint.com/" -f $tenant | |
$siteTitle = "siteToShareTitle" | |
$siteToShareUrl = "https://{0}.sharepoint.com/sites/{1}" -f $tenant, $siteTitle | |
$adminSiteUrl = "https://{0}-admin.sharepoint.com/" -f $tenant | |
# As we want to check tenant wide settings then connect to tenant admin site | |
# Prompts for credentials. This is required if the account using multi-factor authentication. | |
Connect-SPOService -Url $adminSiteUrl | |
# check tenant level sharing as whatever restriction is set here cannnot be lowered on the site we want to share below | |
Get-SPOTenant | fl SharingCapability | |
# SharingCapability : ExternalUserSharingOnly | |
# now check the site we want to share | |
Get-SPOSite $siteToShareUrl | fl SharingCapability | |
# SharingCapability : Disabled | |
# set this sharing to match the level set at the tenant | |
set-sposite -identity $siteToShareUrl -sharingcapability ExternalUserSharingOnly | |
# | |
# Now we are able to share our site with our desired external users | |
# | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment