using (SPWeb web = site.OpenWeb("MySite")) { SPWeb parentWeb = web.ParentWeb; SPGroup ownersGroup = parentWeb.SiteGroups["SomeOwnersGroup"]; web.AssociatedOwnerGroup = ownersGroup; web.BreakRoleInheritance(true); SPRoleAssignment roleassignment = new SPRoleAssignment(ownersGroup); SPRoleDefinition roleDefinition = parentWeb.RoleDefinitions["Full Control"]; roleassignment.RoleDefinitionBindings.Add(roleDefinition); web.RoleAssignments.Add(roleassignment); web.Update(); }
Hope this helps.
No comments:
Post a Comment