Forum Discussion
DisableSharingForNonOwners with pnp or CSOM
In the admin center - site collections - sharing, there is a dialog with the option :
Allowing Non-Owners to Invite New Users.
I'd like to turn this to 'Not Allowed' using CSOM C#.
Does any one know where this settings lives ?
Thanks,
Dave
Added disabling "Allow access requests" setting to my original code example. It's just emptying RequestAccessEmail property.
- Matti PaukkonenIron Contributor
Setting actually turns off all Access Request Settings on site permissions (.../_layouts/15/user.aspx)
I have done something similar like this (it's missing Allow Access Request setting):
Group associatedMemberGroup = ctx.Web.AssociatedMemberGroup; Web web = ctx.Web; ctx.Load(associatedMemberGroup); ctx.Load(web); ctx.ExecuteQuery(); associatedMemberGroup.AllowMembersEditMembership = false; associatedMemberGroup.Update(); web.MembersCanShare = false;
web.RequestAccessEmail = ""; web.Update(); ctx.ExecuteQuery();- David GroomsCopper Contributor
I've tried that code already, but it doesn't change the values shown in the Sharing dialog.
Not sure if ithas the desired effect, I was hoping to verify by seeing the settings int eh form change.
Dave
- Matti PaukkonenIron Contributor
My example turns off "Allow members to share..." and "Allow members to invite..." check boxes on Access Request Settings. If you turn off "Allow access requests" checkbox, admin center Sharing dialog displays "Status: Not allowed.", at least in my dev tenant.