I am trying to programmatically set the "Site sharing settings" options under "Site Permissions" -> "Change how members can share" screen on a Modern site. I would like to set the site to the middle option. Basically I want Members to be able to share individual folders but not the entire site.
(This is not the same as making a site public/private, and also not the same as the external sharing settings.)
I would prefer a solution with Microsoft Graph or CSOM but would really be open to any kind of programmatic way to set this (e.g. site designs/site scripts, SharePoint REST API).
The closest thing I have found is the
web.MemberCanShare bool property in CSOM but that seems to only toggle between the 1st and 3rd options.
Does anyone know how to set this?