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= ""
$SiteURL= ""
#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?


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

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


Please Login and comment to get your questions answered!

Powered by Blogger.