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();
I want to remove the existing "Read" Permission Level for the Group(that too only for this list)
Please suggest where am I going wrong.
Thanks in advance!!!