Forum Discussion
Disable sharing for non owners without disabling access request
Any possibility to disable sharing for non owners without disabling access request for SharePoint Online sites?
"Turn off sharing for non-owners on all sites in this site collection" in SharePoint admin center or DisableSharingForNonOwners switch for Set-SPOSite command, will turn off "Allow access request" as well. It's more useful to have approval process and let owner approve/reject if anyone share document/site instead of turning it off comepletely.
- JoostvdLindenBrass Contributor
Hi Kambiz Niktabar,
Quite late to the party, but maybe still relevant for others.
I just encountered the same situation.
You can resolve this also by using Power Automate and sending an HTTP request to the SharePoint REST API.
- For parameter 'Site Address' you fill in the site URL for which you'd like to disable sharing for non-owners.
- For URI, you will need to provide the (single digit) ID of the SharePoint group '... Members' of the site. Please note that the ID is not always number 5. It changes per site.
To determine the ID of the SharePoint group '... Members', you can execute the following HTTP request where request body should be empty:
GET https://x.sharepoint.com/sites/x/_api/web/sitegroups
The response will be all SharePoint groups that exist within the site. You can also filter down results using the filter parameter: https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-odata-query-operations-in-sharepoint-rest-requests#select-items-to-return
For example: https://x.sharepoint.com/sites/x/_api/web/sitegroups?$filter=Title 'eq 'Team Site Members'
Hope this helps.
Joost
- djbprogrammerCopper Contributor
Hi Microsoft,
Do you have an answer for this issue?