Google Reviews
If you find this content or our services useful, please leave us a review.

This example shows how we can find a users SharePoint group membership by utilising SPGroupCollection.  Remember that if you are running your code with SPSecurity.RunWithElevatedPrivileges, you should set the SPUser value OUTSIDE of this elevated code otherwise it will not work for the current user running the browser session.

SPUser user = SPContext.Current.Web.CurrentUser;

SPGroupCollection groupColl = user.Groups;
foreach (SPGroup grp in groupColl)
    groupMembership.Text += grp.Name + ",";


Find a Users SharePoint Group Membership
Comments have now been disabled. If you have a question to ask about this post please ask the community!