Forum Discussion

David Shvartsman's avatar
David Shvartsman
Copper Contributor
Feb 20, 2018
Solved

Unable to modify SharingCapability property for SPO Site using Set-SPOSite

We are trying to configure SPO Sites for sharing with external users using PowerShell by executing the following command:

Set-SPOSite -Identity "https://{tenant}.sharepoint.com/sites/{sitename}" -SharingCapability ExternalUserSharingOnly -SharingAllowedDomainList "{list of domains}" -SharingDomainRestrictionMode AllowList

The -SharingAllowedDomainList parameter works fine; the -SharingCapability parameter does not.

Changes the settings using GUI works fine. And can be read in PowerShell by Get-SPOSite -Identity "https://{tenant}.sharepoint.com/sites/{sitename}"

  • Have you tried setting the -SharingCapability setting first by itself then adding the others? I use that flag all the time and it works. What error are your receiving? It's possible that you must have the Sharing setting on the tenant level to a level that falls under the setting you are setting for that site. So the tenant level setting probably needs to allow external sharing before you can set it at the site level. Just a thought, but try solo, and maybe even set it to a lesser setting and see if it takes, if it does and it's not letting you set to external users it might be that tenant setting slider that needs increased to allow it on a site.

4 Replies

  • Thank you Christopher Webb for the advise. I have to set the properties one by one like this: You will need to do multiple commands: $url = https://{tenant}.sharepoint.com/sites/{site name} Set-SPOSite -Identity $url -SharingCapability ExternalUserSharingOnly Set-SPOSite -Identity $url -SharingDomainRestrictionMode AllowList -SharingAllowedDomainList "{domains}" get-SPOSite -Identity $url | fL URL, Template, Owner,SharingCapability, SharingAllowedDomainList, ConditionalAccessPolicy, SharingDomainRestrictionMode, SharingBlockedDomainList
  • Have you tried setting the -SharingCapability setting first by itself then adding the others? I use that flag all the time and it works. What error are your receiving? It's possible that you must have the Sharing setting on the tenant level to a level that falls under the setting you are setting for that site. So the tenant level setting probably needs to allow external sharing before you can set it at the site level. Just a thought, but try solo, and maybe even set it to a lesser setting and see if it takes, if it does and it's not letting you set to external users it might be that tenant setting slider that needs increased to allow it on a site.
    • David Shvartsman's avatar
      David Shvartsman
      Copper Contributor

      The Sharing is enabled on the tenant and work fine. I can set the setting using GUI.

      Thank you Christopher Webb for the advise. I have to set the properties one by one like this:

      You will need to do multiple commands:

      Set-SPOSite -Identity "https://{tenant}.sharepoint.com/sites/{site name}" -SharingCapability ExternalUserSharingOnly

      Set-SPOSite -Identity "https://{tenant}.sharepoint.com/sites/{site name}" -SharingAllowedDomainList "{domains}"

      Set-SPOSite -Identity "https://{tenant}.sharepoint.com/sites/{site name}" -SharingDomainRestrictionMode AllowList

       

      • Deleted's avatar
        Deleted
        Cool, glad it worked, I figured it was an issue trying to do it all at once.

Resources