An InfoPath form is, at its heart, simply an xml document. As such, you can use Linq To XML to query it (or make changes, etc). There is one small trick to it though. You must include the “my” namespace that InfoPath generates in its forms. check out this example:
XNamespace myNamespace = "http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-02-15T09:18:32";
// then incorporate the namespace into your normal query
var people = from groupnode in xdoc.Root.Descendants(myNamespace + "groupnode")
Once you do that, your gold!
Now, if anyone can tell me how to use LINQ to XML in the code behind of an InfoPath form, I’d be really grateful!