I am working with SharePoint 2010. I am creating groups in my site through code. There is no issue in that. At the time of creation I provide "Reader" role for my groups. But when I browse the listing of site groups in my site the group shows it has "Limited Access" role. Could any one help me on this?
public static SPGroup CreateGroup(SPWeb web1, string groupName)
{
SPWeb web = web1.Site.RootWeb;
SPUser user = web.CurrentUser;
web.SiteGroups.Add(groupName, user, user, groupName);
SPGroup oGroup = web.SiteGroups.TryGet(groupName);
if (oGroup != null)
{
SPRoleDefinition role = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPRoleAssignment roleAssignment = new SPRoleAssignment(oGroup);
roleAssignment.RoleDefinitionBindings.Add(role);
web.RoleAssignments.Add(roleAssignment);
web.Update();
return oGroup;
}
else
return null;
}