CSOM Powershell code to remove permission level from a sharepoint group

I have a list in which I want to remove "Contribute" Permission Level for a particular group "List Members Group".

After removing this, I want to add "Read" Permission level. Basically, I want the users of this group to have "Read" for this list.

Here's the code which is not working for me #Get the list $list = $web.Lists.GetByTitle("EmployeesList") $ctx.load($list) $ctx.ExecuteQuery() #Break Role Inheritence $list.BreakRoleInheritance($true, $false) #Get the Members Group $memberGroup=$web.AssociatedMemberGroup $ctx.Load($memberGroup) $ctx.ExecuteQuery() #Get the role assignment for the particular Group $roleAssign = $list.RoleAssignments.GetByPrincipal($memberGroup); $ctx.Load($roleAssign) #Get the role definition for the particular Group $roleDefinition = $web.RoleDefinitions.GetByName("Contribute") $ctx.Load($roleDefinition) #Remove the role $roleAssign.RoleDefinitionBindings.Remove($roleDefinition); $ctx.Load($roleAssign) $roleAssign.Update() $list.Update();

August 23rd, 2015 10:37am

Hi,

Please check the links below

https://social.technet.microsoft.com/Forums/sharepoint/en-US/dca30ea7-d5e3-4498-8705-c68fa93be35b/using-powershell-remove-a-base-permission-from-a-permission-level?forum=sharepointadminprevious

https://social.technet.microsoft.com/Forums/sharepoint/en-US/6773d68c-415a-442b-9fef-ce1220af55e9/remove-permissions-from-group-using-powershell?forum=sharepointgeneralprevious

Free Windows Admin Tool Kit Click here and download it now
August 23rd, 2015 12:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics