/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:
Set-SPOTenant -SharingCapability ExternalUserAndGuestSharing # "Anyone"
Set-SPOSite -Identity https://contoso.sharepoint.com/sites/finance -SharingCapability ExistingExternalUserSharingOnlyReproduce it
PowerShell converts the value before the cmdlet runs, so the error appears without a connection (module 16.0.27709.12000):
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 value | Admin center label | Meaning |
|---|---|---|
| ExternalUserAndGuestSharing | Anyone | Guests by email and anonymous "Anyone" links |
| ExternalUserSharingOnly | New and existing guests | Guests must sign in; no anonymous links |
| ExistingExternalUserSharingOnly | Existing guests | Only guests already in the directory |
| Disabled | Only people in your organization | No 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
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/microsoft.online.sharepoint.powershell/set-spotenant
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/microsoft.online.sharepoint.powershell/set-sposite
- learn.microsoft.comlearn.microsoft.com/en-us/sharepoint/turn-external-sharing-on-or-off
Related pages
config · sharepoint-onlineSharePoint Online SharingCapability: Set-SPOTenant and Set-SPOSite external sharing valuesSharingCapability sets external sharing for the tenant (Set-SPOTenant) or one site (Set-SPOSite). Values, admin center labels and how site and tenant combine.errors · sharepoint-onlineNo connection available. Use Connect-SPOService before running this CmdLet.SharePoint Online Management Shell cmdlets like Get-SPOSite and Set-SPOTenant need a session. Run Connect-SPOService with your tenant's -admin URL first.errors · teamsNew-Team -Visibility: The argument does not belong to the set "Public,Private,HiddenMembership"New-Team -Visibility accepts only Public, Private or HiddenMembership. Values such as Org, Internal or Hidden fail validation before any call to Teams is made.