Skip to content

/errors/sharepoint-online/sharingcapability-cannot-convert-value

Set-SPOTenant: Cannot bind parameter 'SharingCapability'. Cannot convert value "Anyone"

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
SharePoint Online PowerShell
exit code
1
versions
Microsoft.Online.SharePoint.PowerShell 16.0.27709.12000, Windows PowerShell 5.1
os
windows

Cannot bind parameter 'SharingCapability'. Cannot convert value "Anyone" to type "Microsoft.Online.SharePoint.TenantManagement.SharingCapabilities". means -SharingCapability got a word that is not one of its enum names. The admin center shows friendly labels; PowerShell needs the internal names:

powershell
Set-SPOTenant -SharingCapability ExternalUserAndGuestSharing      # "Anyone"
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/finance -SharingCapability ExistingExternalUserSharingOnly

Reproduce it

PowerShell converts the value before the cmdlet runs, so the error appears without a connection (module 16.0.27709.12000):

powershell
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
try {
  Set-SPOTenant -SharingCapability Anyone -ErrorAction Stop
} catch {
  $_.Exception.Message
}

Output

Cannot bind parameter 'SharingCapability'. Cannot convert value "Anyone" to type "Microsoft.Online.SharePoint.TenantManagement.SharingCapabilities". Error: "Unable to match the identifier name Anyone to a valid enumerator name. Specify one of the following enumerator names and try again:
Disabled, ExternalUserSharingOnly, ExternalUserAndGuestSharing, ExistingExternalUserSharingOnly"

The message lists the four valid names.

Admin center label to PowerShell value

SharingCapability valueAdmin center labelMeaning
ExternalUserAndGuestSharingAnyoneGuests by email and anonymous "Anyone" links
ExternalUserSharingOnlyNew and existing guestsGuests must sign in; no anonymous links
ExistingExternalUserSharingOnlyExisting guestsOnly guests already in the directory
DisabledOnly people in your organizationNo external sharing

The same names are used by Set-SPOSite -SharingCapability and Set-SPOTenant -OneDriveSharingCapability. A site cannot be more permissive than the tenant setting: see SharingCapability.

Sources