Enabling External Sharing in SharePoint Online

 

Perhaps you've tried to share a folder, document library, or site with an external collaborator in SharePoint Online and gotten the error message "Your organization's policies don't allow you to share with these users." The rest of the message advises you to set External Sharing in the Office 365 admin center, something only a global admin can do. Unfortunately, this does not appear to be sufficient, as discussed in Unable to Share with External Users. This problem could be limited to site collections for groups, collections that are currently hidden in the SharePoint admin center.

If this is the case, you need to use PowerShell to set the tenant's external sharing. This is easy to do -- here's how. These instructions must be performed by a global admin.

Download and install the SharePoint Online Management shell.

In the shell, execute the following commands. Wherever you see angle brackets (<>) substitute your values.

$adminUPN="<global admin user name>"
$orgName="<your organization name as it appears in the SharePoint online URL>".
$usercredential = Get-Credential -username $adminUPN -Message "type password"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Set-SPOTenant -SharingCapability ExternalUserAndGuestSharing

To see current tenant settings execute Get-SPOTenant after the Connect command.

It appears necessary to set sharing to ExternalUserAndGuestSharing; ExternalUserSharingOnly was not sufficient, in our case at least.

To ensure that sharing is enabled for a specific group's team site, execute the following commands:

$siteurl="https://$orgName.sharepoint.com/sites/<group name>"
set-sposite -identity $siteurl -sharingcapability ExternalUserAndGuestSharing

Example

Let's suppose that Jane Smith is the global admin for Contoso, which has a Customer Strategy group. In this example, parameters would have the following values:

Global admin user name: jsmith@contoso.com
Organization name:  contoso, assuming the URL was https://contoso.sharepoint.com
Group name: customerstrategy

With these parameters, the commands would look like this:

$adminUPN="jsmith@contoso.com"
$orgName="contoso"
$usercredential = Get-Credential -username $adminUPN -Message "type password"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Set-SPOTenant -SharingCapability ExternalUserAndGuestSharing
$siteurl="https://$orgName.sharepoint.com/sites/customerstrategy"
set-sposite -identity $siteurl -sharingcapability ExternalUserAndGuestSharing

Additional Information

Microsoft Tech Community Contributors. (2017). Unable to Share with External Users.

Microsoft Docs. (2017). Set-SPOTenant.

The Scripting Guys. (2016). Manage your SharePoint Online tenant with PowerShell.

Microsoft Office Support. (2017). Manage external sharing for your SharePoint Online environment.

Skelly, P. (2017). How To Enable External Sharing for Office 365 Group Site Collections.

Comments