SharePoint 2010 change list permission -


I have a SP list contained in the web and when the web provides an event receiver then list using this code Changes permissions:

  [...] SPList theList = Web List [listName]; TheList.BreakRoleInheritance (wrong); SP Group Group = Web. Group ["my group"]; SPRoleAssignment ra = new SPRoleAssignment (group); SPRoleDefinition role def = web Reel diners GetByType (SPRoleType.Contributor); Ra.RoleDefinitionBindings.Add (roleDef); List.RoleAssignments.Add (ra); List.Update ();  

In the workflow I need to change the permission for the group of readers instead of the contributor. I have used the following code:

  SPList theList = Web.Lists [listName]; Leading (SPRoleAssignment Assignment in List Resolutions) {If (Assignment .member == "MyGroup") {Assignment.rollditionBinding. Removalal (); SPRoleDefinition rda = web.RoleDefinitions.GetByType (SPRoleType.Reader); Assignment.RoleDefinitionBindings.Add (RDA); }}  

Although this code is not working and does not change the permissions on the list.

Can anyone help in understanding how the right way to change permission is an existing principal?

Thank you

You get a theList .Update () After your novel statement


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -