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= "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

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?
SharePoint Online: How to Disable Sharing for Non-Owners using PowerShell? SharePoint Online: How to Disable Sharing for Non-Owners using PowerShell? Reviewed by Salaudeen Rajack on November 16, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.