<?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>SharePoint List with InfoPath C#</title><link>https://www.infopathdev.com:443/forums/thread/29008.aspx</link><pubDate>Thu, 29 May 2008 01:05:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:29008</guid><dc:creator>phamj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/29008.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=29008</wfw:commentRss><description>&lt;p&gt;I am trying to do something similar to this &lt;a class="" title="Utilizing Secondary Datasource in InfoPath" href="http://weblogs.asp.net/jan/archive/2004/03/10/87466.aspx"&gt;click here&lt;/a&gt;&amp;nbsp;- utilizing secondary datasource in InfoPath, however in C#.&amp;nbsp; I found another article that connect the &lt;a class="" href="http://aspalliance.com/498_Secondary_Data_Source_Web_Service_Parameters_using_C_at_Runtime_in_InfoPath.3"&gt;secondary data source to a webservice&lt;/a&gt;&amp;nbsp;- quite helpful but I still couldn&amp;#39;t get around to making it work properly.&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#008000" size="2"&gt;// Get a reference to the secondardy datasource&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;IXMLDOMDocument2 spDOM = (IXMLDOMDocument2)thisXDocument.DataObjects[&amp;quot;Contact Details&amp;quot;].DOM;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000" size="2"&gt;// Set the SelectionNamspaces to find the correct fields&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;spDOM.setProperty(&amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:dfs=\&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution\&amp;quot;&amp;quot;);&lt;/font&gt;&lt;font size="2"&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// Get the selected contact text&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; selectedContact &lt;/font&gt;&lt;font size="2"&gt;= thisXDocument.DOM.selectSingleNode(&amp;quot;/my:document/my:metadata/my:doc_contact_name&amp;quot;).text; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000" size="2"&gt;// Get the selected node&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;spDOM.selectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/dfs:Contact_Details[@Name=&amp;#39;&amp;quot; + selectedContact + &amp;quot;&amp;#39;]&amp;quot;);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#008000" size="2"&gt;// Set the texbox texts&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;thisXDocument.DOM.selectSingleNode(&amp;quot;/my:document/my:metadata/my:doc_contact_role&amp;quot;).text = spDOM.documentElement.attributes.getNamedItem(&amp;quot;Title&amp;quot;).text;&lt;/font&gt;&lt;font size="2"&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;/font&gt;&amp;nbsp;&amp;nbsp;Just wondering if anyone could point out what I&amp;#39;m doing wrong.&amp;nbsp; &lt;strong&gt;The error: Object reference not set to an instance of an object&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance. &lt;/p&gt;</description></item></channel></rss>