0

I'm trying to set the Sharing setting of a site in a provisioning script. After creating a Team site (classic experience) site, I want to set the sharing to new and existing users we have set in the Sharing settings of the admin center. The tenant is set to disabled, not sure if this has an impact, we want external sharing to be off except for a few limited sites at this point.

After creating the site via PowerShell, I try executing Set-SPOSite -Identity $siteURL -SharingCapability ExternalUserSharingOnly. It doesn't throw any errors, but it doesn't set the appropriate value, still reads disabled in PowerShell and is disbaled in the admin center.

What is happening?

0

From your description, external sharing is disabled at organization level.

Quote from Microsoft:

To allow external sharing on any site, you must allow it at the organization level.

---------------------------Update--------------------------------------

Please try following PnP powershell to set external sharing at tenant level:

Connect-PnPOnline -Url https://tenant.sharepoint.com -Credentials (Get-Credential)
  
Set-PnPTenant -SharingCapability $ExternalUserAndGuestSharing

Reference:

https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/set-pnptenant?view=sharepoint-ps

2
  • I can manually set it in the SPO admin center though, if it can be set manually, why can it not be set programmatically? – Eric Alexander Nov 17 '20 at 13:53
  • I have updated my reply, please check it. – Julie_MSFT Nov 18 '20 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.