Forum Discussion
Kambiz Niktabar
Jul 14, 2017Copper Contributor
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 a...
JoostvdLinden
May 10, 2023Brass 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