I want to get the group of the connected user
The problem is when I connect to sharepoint by any account, the current logged in account in my workflow got by Web.CurrentUser
is always SHAREPOINT\System.
What I want is the real connected user to check a group of this user:
public static bool IsUserMemberOfGroup(string groupName)
{
using(SPSite site = new SPSite(sitename)){
using(SPWeb oweb = site.OpenWeb()){
SPUser user = oweb.CurrentUser;
if(user.Groups["groupename"].loginName == groupName){
//do something
}
}
}
}