webElevated.AllowUnsafeUpdates = true;
string libGrpName = list.Title + "_ViewOnly";
SPGroup grp = webElevated.SiteGroups[libGrpName];
SPRoleAssignment roleAssignmentAdmin = new SPRoleAssignment((SPPrincipal)grp);
SPRoleDefinition roleAdmin = webElevated.RoleDefinitions["View only"];
roleAssignmentAdmin.RoleDefinitionBindings.Add(roleAdmin);
list.RoleAssignments.Add(roleAssignmentAdmin);
list.Update();
webElevated.AllowUnsafeUpdates
= false;
No comments:
Post a Comment