<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: LINQ with InfoPath in VSTA</title><link>https://www.infopathdev.com:443/forums/thread/63346.aspx</link><pubDate>Wed, 19 Jan 2011 17:18:24 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63346</guid><dc:creator>barberj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63346.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63346</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Simple in the end.&lt;/p&gt;&lt;p&gt;I needed to use item.Descendents instead of item.Element.&lt;/p&gt;&lt;p&gt;Doh! &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: LINQ with InfoPath in VSTA</title><link>https://www.infopathdev.com:443/forums/thread/63345.aspx</link><pubDate>Wed, 19 Jan 2011 16:50:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:63345</guid><dc:creator>barberj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/63345.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=63345</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I have the same issue even with VS 2008. &lt;/p&gt;&lt;p&gt;q (the LINQ query) returns as type System.Linq.Enumerable+WhereSelectEnumerableIterator`2[System.Xml.Linq.XElement,VB$AnonymousType_0`3[System.String,System.String,System.String]]&lt;/p&gt;&lt;p&gt;&amp;nbsp;Not sure how to get the value out. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: LINQ with InfoPath in VSTA</title><link>https://www.infopathdev.com:443/forums/thread/42419.aspx</link><pubDate>Wed, 03 Jun 2009 03:32:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42419</guid><dc:creator>dga63</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42419.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42419</wfw:commentRss><description>&lt;p&gt;Hi Patrick,&lt;/p&gt;
&lt;p&gt;To be clear, this is not a full Visual Studio&amp;nbsp;... it&amp;#39;s &amp;quot;Microsoft Visual Studio Tools for Applications&amp;quot; (VSTA), which is a built-in extension capability&amp;nbsp;in InfoPath 2007 (and other Office 2007 products, and is available to third parties to provide similar extension capability, I think).&amp;nbsp; Poking about a bit it looks like the VSTA that comes with InfoPath might be VS2005-based, and that may be the source of the problem ... not clear if VS2005 has the necessary LINQ awareness.&lt;/p&gt;
&lt;p&gt;I have since migrated the project from VSTA (essentially built-in to InfoPath) into a demo version of VS 2008 Pro, and everything works fine once I do that.&amp;nbsp; As this is something of a hobby effort, I was hoping to do all this without needing to buy VS ... but I am enjoying the development better in VS and so I might just have to give in and accept that hobbies can be expensive.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;DGA&lt;/p&gt;</description></item><item><title>Re: LINQ with InfoPath in VSTA</title><link>https://www.infopathdev.com:443/forums/thread/42192.aspx</link><pubDate>Thu, 28 May 2009 06:26:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42192</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42192.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42192</wfw:commentRss><description>&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Hi DGA,&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;"&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;What version are you using? Perhaps you have an old version.&amp;nbsp; For instance, I do not see syntax highlighting on the var and from keywords - maybe that&amp;#39;s because you have an older version of LINQ. On the other hand, maybe you just cut and pasted from something other than VS.&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="COLOR:#1f497d;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;</description></item><item><title>LINQ with InfoPath in VSTA</title><link>https://www.infopathdev.com:443/forums/thread/41995.aspx</link><pubDate>Sat, 23 May 2009 12:35:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:41995</guid><dc:creator>dga63</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/41995.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=41995</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m trying to use LINQ in InfoPath FormCode, using VSTA as provided with InfoPath 2007.&amp;nbsp; The issue I am experiencing is that VSTA does not permit the LINQ query syntax.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;For instance, there are code samples posted at &lt;a href="http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/04/29/code-samples-from-my-short-talk-about-linq-to-xml.aspx"&gt;&lt;font color="#0033cc"&gt;http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2009/04/29/code-samples-from-my-short-talk-about-linq-to-xml.aspx&lt;/font&gt;&lt;/a&gt;.&amp;nbsp; This part of that code works fine:&lt;br /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;XDocument infoPathDocument = XDocument.Load(&lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; System.IO.StringReader(MainDataSource.CreateNavigator().OuterXml));&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;However, the query does not:&lt;br /&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;div style="BACKGROUND-COLOR:white;COLOR:black;"&gt;&lt;pre&gt;var items = from item &lt;span style="COLOR:blue;"&gt;in&lt;/span&gt; infoPathDocument.Descendants(myNamespace + &lt;span style="COLOR:#a31515;"&gt;&amp;quot;Item&amp;quot;&lt;/span&gt;)
            select &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt;
            {
              Name = item.Element(myNamespace + &lt;span style="COLOR:#a31515;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;).Value,
              ...
             };&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;In the VSTA editor, it starts complaining at the &amp;quot;item&amp;quot; following &amp;quot;= from&amp;quot;, and so the build fails.&lt;br /&gt;&lt;br /&gt;Some details that folks might ask about:&lt;br /&gt;&lt;br /&gt;1.&amp;nbsp; I am doing ...&lt;/p&gt;
&lt;blockquote&gt;
&lt;div style="BACKGROUND-COLOR:white;COLOR:black;"&gt;&lt;pre&gt;&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; Microsoft.Office.InfoPath;
&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; System;
&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; System.Linq;
&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; System.Xml.Linq;
&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; System.Xml;
&lt;span style="COLOR:blue;"&gt;using&lt;/span&gt; System.Xml.XPath;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;2.&amp;nbsp; I have manually added References to System.Core and System.Xml.Linq to support the above.&lt;/p&gt;
&lt;p&gt;I would greatly appreciate suggestions about what I might be missing, in getting this to work ...&lt;br /&gt;&lt;br /&gt;Thanks in advance !&lt;br /&gt;&lt;br /&gt;DGA&lt;/p&gt;</description></item></channel></rss>