public void CheckcurrentuserinGroup()
{
SPGroup grp = SPContext.Current.Web.SiteGroups["GroupName"];
if (grp != null)
{
if (grp.ContainsCurrentUser)
{
//True
}
else
{
//false
SPUtility.HandleAccessDenied(new Exception("You don’t have access rights to see this content. Contact Administrator"));
}
}
}
{
SPGroup grp = SPContext.Current.Web.SiteGroups["GroupName"];
if (grp != null)
{
if (grp.ContainsCurrentUser)
{
//True
}
else
{
//false
SPUtility.HandleAccessDenied(new Exception("You don’t have access rights to see this content. Contact Administrator"));
}
}
}
No comments:
Post a Comment