I’m using PnP PowerShell where you enable external sharing using the following code:
# Connect to admin site Connect-PnPOnline https://contoso-admin.sharepoint.com # Enable external sharing. Possible values are: # ExistingExternalUserSharingOnly # ExternalUserAndGuestSharing # ExternalUserSharingOnly # Disabled Set-PnPTenantSite -Url https://contoso.sharepoint.com/teams/Communication201 -Sharing ExternalUserSharingOnly
Similar code for SPO commandlets would be, where we also allow anonymous sharing of documents:
# Connect to admin site Connect-SPOService -Url https://contoso-admin.sharepoint.com Set-SPOSite -Identity https://contoso.sharepoint.com/teams/Communication201 -SharingCapability ExternalUserAndGuestSharing
I chose to use ExternalUserSharingOnly as you cannot share the full site anonymously, only documents, and sharing documents anonymously from a Communication site might not be the most obvious scenario.
Note: You have to ensure that the sharing settings on your tenant allows the sharing capability you are setting for the site.
The next step is to invite your external users. If you try to share using the Share site button in the UI, this won’t allow adding an external user (per writing this post).
The Share button is disabled for external users.
Instead navigate to Site permissions and hit the advanced permissions settings link. Or tack /_layouts/15/user.aspx at the end of the URL of your site. This is the old SharePoint permission page where you can hit the Grant Permissions button, and fill in your external user. Be sure to check off the email invitation and pick which access level the user should have. I’m adding my external user as a visitor in this example.
When clicking the site link in the invitation e-mail my external user is now added to the site and can browse around. Notice that as an external user you get blue/black suite bar, as the tenant theme won’t show for external users.
Happy sharing!