Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carlosdoliveira/895c770d3fe79f806ad11a593fe310a0 to your computer and use it in GitHub Desktop.
Save carlosdoliveira/895c770d3fe79f806ad11a593fe310a0 to your computer and use it in GitHub Desktop.
##############################
# Enable External Sharing in Sharepoint Online Communication Sites
#
# Author: Carlos Oliveira
# Instagram: @_cloudsquad
# Version: 3.0
# Last Modified: 11/09/2018
#
# To validate if the command worked, use this cmdlet
# > Get-SPOSite -Identity https://$orgName.sharepoint.com/sites/$siteName | Select-Object Title,Owner,SharingCapability
#
##############################
# Insert O365 Credentials
$cred=Get-Credential
# Define your organization Tenant name without "onmicrosoft.com"
$orgName="contoso"
# Site title where you want to enable External Sharing.
$siteName="NomeDoSite"
# Connecting to Sharepoint Online Service
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $cred
Set-SPOSite -Identity https://$orgName.sharepoint.com/sites/$siteName -SharingCapability ExternalUserAndGuestSharing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment