Skip to content

/config/sharepoint-online/sharingcapability

SharePoint Online SharingCapability: Set-SPOTenant and Set-SPOSite external sharing values

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
SharePoint Online PowerShell
file
SharePoint Online tenant / site collection (Set-SPOTenant, Set-SPOSite)
key
SharingCapability
type
enum SharingCapabilities
default
ExternalUserAndGuestSharing (tenant)

SharingCapability decides how far content can be shared outside the organization. Set it for the whole tenant with Set-SPOTenant and narrow it for single sites with Set-SPOSite, after Connect-SPOService -Url https://contoso-admin.sharepoint.com:

powershell
Set-SPOTenant -SharingCapability ExternalUserSharingOnly
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/finance -SharingCapability Disabled

Values

The enum has four names in module 16.0.27709.12000 (read offline), and Set-SPOTenant -SharingCapability, -OneDriveSharingCapability and Set-SPOSite -SharingCapability all use the same type:

powershell
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
$t = [Microsoft.Online.SharePoint.TenantManagement.SharingCapabilities]
[enum]::GetNames($t) -join ', '
foreach ($c in 'Set-SPOTenant:SharingCapability','Set-SPOTenant:OneDriveSharingCapability','Set-SPOSite:SharingCapability') {
  $cmd, $par = $c -split ':'
  $pt = (Get-Command $cmd).Parameters[$par].ParameterType
  '{0} -{1}: {2}' -f $cmd, $par, $pt.GetGenericArguments()[0].Name
}

Output

Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly
Set-SPOTenant -SharingCapability: SharingCapabilities
Set-SPOTenant -OneDriveSharingCapability: SharingCapabilities
Set-SPOSite -SharingCapability: SharingCapabilities
ValueAdmin center labelWho can receive shares
ExternalUserAndGuestSharingAnyoneGuests who sign in, and anyone with an "Anyone" link (default for the tenant)
ExternalUserSharingOnlyNew and existing guestsGuests who sign in; new guests are invited by email
ExistingExternalUserSharingOnlyExisting guestsOnly guests already in your directory
DisabledOnly people in your organizationNobody outside the organization

Tenant and site

The tenant value is the upper limit. A site can be set to the same or a more restrictive value, never a more permissive one. Get-SPOSite -Identity URL | Select-Object SharingCapability,SiteDefinedSharingCapability shows the effective value (site and tenant combined) and the value stored on the site.

OneDriveSharingCapability is the same setting for OneDrive sites and cannot be more permissive than SharingCapability.

Check the current values

powershell
Get-SPOTenant | Select-Object SharingCapability,OneDriveSharingCapability
Get-SPOSite -Identity https://contoso.sharepoint.com/sites/finance | Select-Object Url,SharingCapability

Query sites one by one with -Identity: when -Limit or -Filter is used, Microsoft documents that SharingCapability and several other properties are not populated and may show a default value.

Sources