3

Is it possible to view and change the external sharing options on tenant level with PowerShell?

I mean these: https://docs.microsoft.com/en-us/sharepoint/turn-external-sharing-on-or-off

I looked at the Get-SPOTenant command, as this contains other sharing options, changed this setting, tried to find anything that changes but didn't see anything.

3 Answers 3

2

Yes, we can change the external sharing in the tenant by the PowerShell command Set-SPOTenant.

You can use the Parameter “SharingCapability” in the PowerShell command Set-SPOTenant.

The valid values are:

ExternalUserAndGuestSharing (default) - External user sharing (share by email) and guest link sharing are both enabled.

Disabled - External user sharing (share by email) and guest link sharing are both disabled.

ExternalUserSharingOnly - External user sharing (share by email) is enabled, but guest link sharing is disabled.

For more detailed information, refer to the articles below.

Set-SPOTenant

Manage your SharePoint Online tenant with PowerShell.

2

You can do it with following option:

Connect-SPOService -Url https://tenantname-admin.sharepoint.com -Credential [email protected]

after connection, you can pick one the below option:

Set-SPOTenant -SharingCapability ExternalUserAndGuestSharing
Set-SPOTenant -SharingCapability ExternalUserSharingOnly
Set-SPOTenant -SharingCapability Disabled

Managing Sharing and Access in SharePoint Online But now there is catch, if external sharing is enabled and being used on many site collection:

If you turn off external sharing for your entire environment and later turn it back on, external users who previously had access to content or documents on sites will regain access to them. If you know that external sharing was previously turned on and in use for specific site collections and you do not want external users to be able to regain access if external sharing is ever turned on again globally, we recommend that you first turn off external sharing for those specific site collections. Source

Now you have to turn off the external sharing on the site collection where it was enabled, run below powershell to get that list:

Get-SPOSite | Select Url, SharingCapability

Now use the Set-SPoSite command to disable it.

Set-SPOSite -Identity ""Sitecolelction url" -SharingCapability Disabled
0

To view existing external sharing configuration,

Get-SPOSite | select SharingCapability

To change or set sharing capability,

Set-SPoSite -SharingCapability <PermissionLevel>

Allowable permission levels are,

  • ExternalUserAndGuestSharing – sets the permission level to Anyone
  • ExternalUserSharingOnly – sets the permission level to New and
  • Existing guests ExistingExternalUserSharingOnly – sets the permission
  • level to Existing guests Disabled – sets the permission level to Only people in your organization

Source: Enable external sharing in SharePoint Online

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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