Good day,
I am checking if the current user belongs to a certain group and it is always returning false. An excerpt of my code is below. THis is running in a Visual Webpart.
bool isApprover = false;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(SPContext.Current.Site.Url))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
SPGroup group = web.Groups["Custom Approvers"];
bool flag = web.IsCurrentUserMemberOfGroup(group.ID);
if (flag)
{
isApprover = true;
}
//}
}
}
});Please assist.