How to check in C# if the current user is in a group or not? Thanks for help.
using (SPSite SPsite = new SPSite("http://sp/sites/test"))
{
using (SPWeb web = SPsite.OpenWeb())
{
SPUser user = web.CurrentUser;
SPGroupCollection groups = user.Groups;
foreach (SPGroup group in groups)
{
string groupName = group.Name;
}
}
}
CSOM not need.