i have the following code , where i am trying to create a new user Group inside my RootSite, and do not assign any permission for it (as i am going to use it inside some sub-sites which have unique permissions). so i tried the following:-
SPRoleDefinition roleDefinition = site.RootWeb.RoleDefinitions.GetByType(SPRoleType.None);
SPRoleAssignment roleAssignment = new SPRoleAssignment(group);
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
site.RootWeb.RoleAssignments.Add(roleAssignment);
site.RootWeb.Update();
but i got this exception:-
"Value does not fall within the expected range."
on the following line of code:-
SPRoleDefinition roleDefinition = site.RootWeb.RoleDefinitions.GetByType(SPRoleType.None);
So can anyone advice on this please? as when i create a new Group using the UI i can set a group without any permission levels..