0

Is it possible to change the Site sharing settings using PnP PowerShell or SPO PowerShell? This includes 'Sharing permissions' as well as 'Access Requests'. These settings for any site can be found under:

Settings > Site permissions > Change how members can share

Screenshot of Permissions tab

Screenshot of Site sharing settings tab

2 Answers 2

0

According to my research, there is currently no complete PowerShell command that can support to change the Site sharing settings. However, you can use the following workaround.

You can use the below PowerShell command to prevents non-owners of a site from inviting new users to the site.

Set-SPOSite -Identity https://contoso.sharepoint.com -DisableSharingForNonOwners

For more information, please refer to "Set-SPOSite".

0

The settings you are looking for can be also found in Site Settings > Site Permission > Access Request Settings (/_layouts/15/user.aspx) where by the wording you can find better search results on web, anyway you can use this piece of powershell to configure it.

PNP Powershell:

Connect-PnPOnline -url "YOUR-SITE-URL-HERE" -Interactive

$web = Get-PnPWeb -Includes MembersCanShare, AssociatedMemberGroup.AllowMembersEditMembership
$web.MembersCanShare=$false
$web.AssociatedMemberGroup.AllowMembersEditMembership=$false
$web.AssociatedMemberGroup.Update()
$web.RequestAccessEmail = $null
$web.Update()
$web.Context.ExecuteQuery()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.