using (SPSite site = (SPSite)properties.Feature.Parent)
{
using (SPWeb web = site.OpenWeb())
{
if (web != null)
{
web.AllowUnsafeUpdates = true;
SPList list = web.Lists["Alert Status v1.0"];
//Creates a new role assignment for a group
SPGroup myGroup = web.SiteGroups["IKM Manager"];
SPRoleAssignmentCollection roleAssignments = web.RoleAssignments;
// SPRoleAssignment accepts a SPPrincipal which can be a SPUser or SPGroup
SPRoleAssignment roleAssignment = new SPRoleAssignment(myGroup);
//Add the new role assignment to the collection of role assignments for the site.
roleAssignments.Add(roleAssignment);
// Stop inheriting permissions
list.BreakRoleInheritance(true);
list.RoleAssignments.Add(roleAssignment);
list.Update();
我在 RoleAssignments.Add(roleAssignment) 上有错误,例如“无法添加具有空角色定义绑定集合的角色分配”。我想停止继承权限并将特定组添加到列表权限。你能帮助我吗?请..
谢谢