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.
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?