Forum Discussion
DisableSharingForNonOwners with pnp or CSOM
- Aug 07, 2017
Added disabling "Allow access requests" setting to my original code example. It's just emptying RequestAccessEmail property.
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();
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 PaukkonenAug 07, 2017Iron Contributor
Added disabling "Allow access requests" setting to my original code example. It's just emptying RequestAccessEmail property.
- David GroomsAug 07, 2017Copper Contributor
That worked !
Thanks,
Dave
- Matti PaukkonenAug 07, 2017Iron 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.
- David GroomsAug 07, 2017Copper Contributor
Any Idea where the 'Allow Access Requests' flag is in CSOM ?
I'm seeing the same thing where my code unchecks the top two boxes, and unchecking the third gives the result I want.
Thanks,
Dave