<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Unable to cast COM object/No such interface supported exception</title><link>https://www.infopathdev.com:443/forums/thread/31643.aspx</link><pubDate>Fri, 22 Aug 2008 14:50:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31643</guid><dc:creator>rhlnvf</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31643.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31643</wfw:commentRss><description>&lt;p&gt;Feel a bit solipsistic replying to my own post, but...&lt;/p&gt;&lt;p&gt;I&amp;#39;ve spent some time considering whether it&amp;#39;s something to do with my install, and I&amp;#39;m becoming more and more certain of that now, so here&amp;#39;s a bit more information.&lt;/p&gt;&lt;p&gt;I have installed: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;* Visual Studio 2005&lt;br /&gt;* InfoPath 2003 SP2&lt;br /&gt;* Microsoft Office InfoPath 2003 Toolkit for Visual Studio 2005&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The most recent work I&amp;#39;ve done on this is to follow one of the MS examples, specifically http://msdn.microsoft.com/en-us/library/aa948065(VS.80).aspx and I&amp;#39;ve received the same cast exception on the Application.XDocuments.New method when attempting to open a valid XML file.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Unable to cast COM object/No such interface supported exception</title><link>https://www.infopathdev.com:443/forums/thread/31639.aspx</link><pubDate>Fri, 22 Aug 2008 09:40:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:31639</guid><dc:creator>rhlnvf</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/31639.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=31639</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m really hoping (and expecting, to be honest) that I&amp;#39;ve made some simple mistake here, so please accept my apologies if this seems a little dim...&lt;/p&gt;

&lt;p&gt;Trying to build a little c# app that retrieves a dataset from a database (not a problem so far), and for each row, creates an infopath form that can then be emailed to a user for completion.&amp;nbsp; To that purpose, I&amp;#39;ve added references to the two Interops I can find: Microsoft.Office.Interop.InfoPath.dll (runtime v1.1.4322) &amp;amp; Microsoft.Office.Interop.InfoPath.Xml.dll (also runtime v1.1.4322)&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;I&amp;#39;ve designed the infopath template form, and saved the .XSN to disk with the intent that my c# app can use it to create a new XDocument for an InfoPathApplication object.&lt;/p&gt;

&lt;p&gt;The code I&amp;#39;m attempting to use is as below:&lt;/p&gt;

&lt;pre&gt;            Microsoft.Office.Interop.InfoPath.Application infoPathApp = new Microsoft.Office.Interop.InfoPath.Application();&lt;br /&gt;            object ob_svr;&lt;br /&gt;            XDocument x_svr;&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                infoPathApp.XDocuments.NewFromSolution(&amp;quot;C:\\obj\\TestWallchartDB.xsn&amp;quot;);&lt;br /&gt;            //ob_svr = infoPathApp.XDocuments.NewFromSolution(&amp;quot;C:\\obj\\TestWallchartDB.xsn&amp;quot;);&lt;br /&gt;            //x_svr = (XDocument) infoPathApp.XDocuments.NewFromSolution(&amp;quot;C:\\obj\\TestWallchartDB.xsn&amp;quot;);&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                /*Unable to cast COM object of type &amp;#39;Microsoft.Office.Interop.InfoPath.XDocumentsCollectionClass&amp;#39; &lt;br /&gt;                 *to interface type &amp;#39;Microsoft.Office.Interop.InfoPath.XDocuments2&amp;#39;. This operation failed because the&lt;br /&gt;                 *QueryInterface call on the COM component for the interface with IID &amp;#39;{096CD647-0786-11D1-95FA-0080C78EE3BB}&amp;#39;&lt;br /&gt;                 *failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;br /&gt;                 */&lt;br /&gt;&lt;/pre&gt;&lt;pre&gt;                 throw;&lt;br /&gt;            }&lt;br /&gt;&lt;/pre&gt;

&lt;p&gt;With any of the three calls to the NewFromSolution method, I get the same &amp;#39;unable to cast&amp;#39; exception.  I&amp;#39;ve seen a fair few examples in these and other forums of people using the method from within Wallchart, so is it simply that I can&amp;#39;t use the method from an external application?&lt;/p&gt;

&lt;p&gt;Many thanks in advance for thoughts&lt;/p&gt;</description></item></channel></rss>