SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to find how to find what permission level a group (within SPWeb.Groups) has. But it seems like there is no easy way to do this. Any ideas?

I have tried creating SPRoleAssignment and passing the group to get the RoleDefinitionBindings, but it seems like creating a new instance does not help with finding existing permission level.

Using SPWeb.AssociatedOwnerGroup does not give me all the "full permission" groups either.

Any help will be greatly appreciated. Thank you!

share|improve this question
up vote 7 down vote accepted

Prints out all the groups for the SPWeb and the group's role names:

using (SPSite site = new SPSite("http://server/sites/sitecollection/"))
    using (SPWeb web = site.OpenWeb("test"))
        foreach (SPRoleAssignment roleAssignment in web.RoleAssignments)
            if (roleAssignment.Member is SPGroup)
                Console.WriteLine("Group: " + roleAssignment.Member.Name);
                foreach (SPRoleDefinition roleDefinition in roleAssignment.RoleDefinitionBindings)
                    Console.WriteLine("\t" + roleDefinition.Name);
share|improve this answer
Thank you!! I was creating the SPRoleAssignment and passing the group to it for instantiation - silly me :) Thanks a bunch! – Tom Apr 17 '12 at 19:36
@Tom You're welcome :) – Kit Menke Apr 17 '12 at 19:37
this throws an exception if my user permission level is low can any one tell me how solve this. – user8284 May 10 '12 at 9:33
@thomas Not sure what you're trying to do... you need permission to view the groups? – Kit Menke May 10 '12 at 19:02
I know this is an old post - he might've solved his problem already, but for anyone finding they need higher privileges to let the code run, just put SPSecurity.RunWithElevatedPrivileges(delegate() { .... } around any block you find that needs elevated privileges. – vapcguy May 1 '15 at 1:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.