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 a sharepoint permission group with some permissionslevels. The name is: "SPProgress". Inside this group I have inserted a AD usergroup with the name "ADProgress".

I would like to check in code if the current user is exist in the SharePoint permision group "SPProgress". But if the current user is exist in the AD usergroup "ADProgress", it needs to return true.

I set the currentuser outside the RunWithElevatedPrivileges in a parameter.

SPUser currentUser = SPContext.Current.Web.CurrentUser;
SPGroup someGroup = somegroup...


if(IsUserExistInGroup(currentUser, someGroup ))
// do some logic
share|improve this question
Did you ever get this working? – Steve Lineberry Mar 1 '13 at 1:25

Since you are using CurrentUser and if you create the a SPWeb object outside of the runwithelevatedprivileges this code should work for you for the SharePoint group:


Since you are using the current user, this code should work for you for the AD group:

share|improve this answer
I am looking for some solution for inside the runwithelevatedprivileges. – Ola Feb 26 '13 at 18:40
Why can't you run this within runwithelevatedprivileges??? Just use the web object created outside runwithelevatedprivileges so it will use the currently logged in user. – Steve Lineberry Feb 26 '13 at 18:53
I am looking for some solution with SPUser and SPGroup as parameters. With these 2 parameters inside the RunWithElevatedPrivileges I would like to check the membership. – Ola Feb 26 '13 at 19:20
Right, that should be fine. The issue comes with you CREATE the spweb or spsite object inside the runwithelevatedprivileges. When that happens the service account is what is assigned to the usertoken and when you try to check permissions they always return true. – Steve Lineberry Feb 27 '13 at 14:06

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.