Posts

Showing posts from February, 2014

SharePoint 2013 - Update List Permissions with Client Object Model

The code below break permission inheritance of a list and add all authenticated users to have read permission level. List list = rootWeb.Lists.GetByTitle("test"); list.BreakRoleInheritance(false, true); RoleDefinition readerRole = clientContext.Web.RoleDefinitions.GetByType(RoleType.Reader); RoleDefinitionBindingCollection rdb = new RoleDefinitionBindingCollection(clientContext); rdb.Add(readerRole); Principal usr = clientContext.Web.EnsureUser("NT Authority\\Authenticated Users"); test.RoleAssignments.Add(usr, rdb); clientContext.ExecuteQuery(); If you want to user the "Everyone", you can use "c:0(.s|true" as the login name