Infopath 2010: Get groups from user

I just want to check if a user is part of a specific group. Well, that should be simple, right? I'm using SharePoint 2010, got an Active Directory Server somewhere and InfoPath 2010. All Users are working with authenticated accounts on their clients and have authenticated users while browsing SharePoint 2010. It should really be simple, right? I mean, come on! It's all Microsoft and all connected. Right?

No.

The short version is: I ended up coding this little thing in C#:

PrincipalContext domain = new PrincipalContext(ContextType.Domain);
UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(domain, User.UserName);

// set field "isMemberTxt" to "true"
try
{
string group = "YOURADGROUP";
GroupPrincipal groupPrincipal = GroupPrincipal.FindByIdentity(domain, group);
bool isMember = userPrincipal.IsMemberOf(groupPrincipal);

if (isMember == true)
{
xnMyForm.SelectSingleNode("/my:myFields/my:isMemberTxt", ns).SetValue("true");
}
}
catch (Exception ex)
{
Console.Write(ex);
}

This will check if the current user is a member of the group "YOURADGROUP" and it will also set the field "isMemberTxt" to true. IT worked for me, but it is not ideal, I you are searching for a no-code-solution like I do. But it's something!

So if I find a no-code-solution, I will post it here.

SharePoint 2010: Failed to register SharePoint services

SharePoint 2010: Flush BLOB cache