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

Requirement: Disable Sharing for Non-Owners in SharePoint Online

PowerShell to Disable Sharing for Non-Owners:
#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

This disables share button for non-owners (members) for a given site collection.
sharepoint online disable sharing for non-owners (members)
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?

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.