SharePoint Online: How to Disable Sharing for Non-Owners using PowerShell?

Requirement: Disable Sharing for Non-Owners in SharePoint Online.

How to Disable Sharing for Members in SharePoint?

To disable sharing for members in SharePoint Online, follow these steps:

  • Settings >> Site Settings >> Site Permissions
  • Click on “Access Request Settings” button in the ribbon. 
  • Uncheck “Allow members to share the site and individual files and folders.”. You can also uncheck  “Allow members to invite others to the site members group, <Group Name>. This setting must be enabled to let members share the site. “

This disables share button for non-owners (members) for a given site.

sharepoint online disable sharing for non-owners (members)

PowerShell to Disable Sharing for Non-Owners:

Here is the PowerShell to disable sharing for non-owners in SharePoint Online.

#Config Variables
$AdminSiteURL= "https://crescent-admin.sharepoint.com"
$SiteURL= "https://crescent.sharepoint.com/sites/marketing"
 
#Connect to SharePoint Online services
Connect-SPOService -url $AdminSiteURL -Credential (Get-Credential)

#Disable Sharing for Non-Owners
Set-SPOSite -Identity $SiteURL -DisableSharingForNonOwners

Found a problem though! when you run this script for the first time, it disables access request! To disable share button in SharePoint Online, use: How to Disable Share Feature in SharePoint Online?

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

2 thoughts on “SharePoint Online: How to Disable Sharing for Non-Owners using PowerShell?

  • January 15, 2021 at 7:47 AM

    Is there any cmdlet to set this option to “Members can share files and folders, but NOT the whole site” ?

    Reply
  • January 15, 2021 at 7:43 AM

    How to reverse this? I also want to be able to set the setting to “Sharing documents en folders, but not the site”.

    Reply

Leave a Reply