New capabilities were recently added to the SharePoint Online Management Shell that allow us to block users from being able to share content with either “Everyone” or “Everyone except external users”.
To do this, fire up the SharePoint Online Management Shell, and connect as usual:
Connect-SPOService -url https://somesite-Admin.sharepoint.com
To view the current settings:
The current sharing dialog before changing any settings:
To hide “Everyone”:
Set-SPOTenant -ShowEveryoneClaim $false
The “Everyone except external users” can be hidden easily as well:
Set-SPOTenant -ShowEveryoneExceptExternalUsersClaim $false
Of course, to turn it back on just run the same command with $true. Note, nothing further has to be done to get these commands to take effect. The next time a user clicks “share”, these items will be hidden.