<?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: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/37280.aspx</link><pubDate>Sat, 17 Jan 2009 16:51:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37280</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37280.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=37280</wfw:commentRss><description>&lt;p&gt;thisXDocument does not exist in the IP 2007 object model.&amp;nbsp; It is characteristic of IP 2003.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t believe there is a way to replace the entire DOM of a data source the way you seem to be trying to do.&amp;nbsp; What you need to do is create an XPathNavigator for the data source with DataConnections[&lt;font color="#800000" size="2"&gt;&amp;quot;&lt;em&gt;data source name goes here&lt;/em&gt;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;].CreateNavigator(), and insert the query parameters using typical XML manipulation methods.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure what you mean by &amp;quot;I cannot seem to get the display control to update.&amp;quot;&amp;nbsp; If you query a secondary data source, any controls bound to it should automatically update without any special tricks.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/37162.aspx</link><pubDate>Thu, 15 Jan 2009 17:19:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37162</guid><dc:creator>StepStep</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37162.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=37162</wfw:commentRss><description>&lt;p&gt;Jimmy, would you take a look at my question following this one please?&lt;/p&gt;
&lt;p&gt;Much appreciated!&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Step.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/37161.aspx</link><pubDate>Thu, 15 Jan 2009 17:18:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:37161</guid><dc:creator>StepStep</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/37161.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=37161</wfw:commentRss><description>&lt;p&gt;I seem to have a great big problem with Web-enabled forms. Not only is the thisXDocument property not available, it seems impossible to get a reference to an XDocument from the Application.&lt;/p&gt;
&lt;p&gt;I am using Infopath 2007 with VS2008 and MOSS 2007.Data sources are web services with query parameters.&lt;/p&gt;
&lt;p&gt;I want to select a value from a drop-down list (which I can, and it is ok) through this code:&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; fldBusinessUnit_Changed(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlEventArgs&lt;/font&gt;&lt;font size="2"&gt; e)&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;int&lt;/font&gt;&lt;font size="2"&gt; index;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; nav = MainDataSource.CreateNavigator();&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; val = nav.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/my:ceaFormFields/my:mainGroup/my:fldBusinessUnit&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).Value;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;Int32&lt;/font&gt;&lt;font size="2"&gt;.TryParse(val, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;out&lt;/font&gt;&lt;font size="2"&gt; index))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;WebServiceConnection&lt;/font&gt;&lt;font size="2"&gt; conn = (&lt;/font&gt;&lt;font color="#008080" size="2"&gt;WebServiceConnection&lt;/font&gt;&lt;font size="2"&gt; )DataConnections[&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;GetApproversByBusinessUnitNumber&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;];&lt;/p&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (!&lt;/font&gt;&lt;font color="#008080" size="2"&gt;String&lt;/font&gt;&lt;font size="2"&gt;.IsNullOrEmpty(conn.Name))&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;{ //etc. }&lt;/p&gt;
&lt;p&gt;and then I want to set a query parameter on a web data source.&lt;/p&gt;
&lt;p&gt;I have tried this code and it works, but I cannot seem to get the display control to update. I can&amp;#39;t seem to be able to assign an XMLDocument to it as a datasource:&lt;/p&gt;&lt;font color="#008000" size="2"&gt;
&lt;p&gt;// Create XmlDocuments.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt; inputDocument = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt;();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt; outputDocument = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt;();&lt;/p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt; errorsDocument = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#008080" size="2"&gt;XmlDocument&lt;/font&gt;&lt;font size="2"&gt;();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// Load input document.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;inputDocument.LoadXml(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt;.Concat(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;lt;?xml version=\&amp;quot;1.0\&amp;quot; encoding=\&amp;quot;utf-8\&amp;quot; ?&amp;gt;&amp;lt;Number&amp;gt;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, index.ToString(), &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;lt;/Number&amp;gt;&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;));&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// Create XPathNavigator objects for documents.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; inputNav = inputDocument.CreateNavigator();&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;XPathNavigator outputNav = outputDocument.CreateNavigator();&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;font size="2"&gt; errorsNav = errorsDocument.CreateNavigator();&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;// Call Execute method.&lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;
&lt;p&gt;conn.Execute(inputNav, outputNav, errorsNav); // how do I get these data into a repeater control? How do I get the form to update?&lt;/p&gt;
&lt;p&gt;Any help will be much, much appreciated!&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Step van Schalkwyk&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35681.aspx</link><pubDate>Thu, 11 Dec 2008 15:38:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35681</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35681.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35681</wfw:commentRss><description>&lt;p&gt;Don&amp;#39;t worry about it.&amp;nbsp; This InfoPath stuff can be tough to get used to but I can say from experience that it all starts to come together sooner or later.&amp;nbsp; I&amp;#39;m glad I was able to help.&lt;/p&gt;
&lt;p&gt;A Merry Christmas to you too!&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35680.aspx</link><pubDate>Thu, 11 Dec 2008 15:20:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35680</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35680.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35680</wfw:commentRss><description>&lt;p&gt;You have got to be kiddiing me.&amp;nbsp; I have been fooling around with this for hours and the rule&amp;nbsp;works all by itself.&amp;nbsp; Sometimes I can be an idiot.&amp;nbsp; Thanks again for all your help and have a Merry Christmas!&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35679.aspx</link><pubDate>Thu, 11 Dec 2008 15:09:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35679</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35679.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35679</wfw:commentRss><description>&lt;p&gt;Thank you, but all that code does is assign the value &amp;quot;&lt;font color="#800000"&gt;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt; &amp;quot; to that field.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m pretty sure that if all you want to do is assign the user name to that field you can use a rule the way I described and skip using code altogether.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35678.aspx</link><pubDate>Thu, 11 Dec 2008 14:57:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35678</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35678.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35678</wfw:commentRss><description>&lt;p&gt;Nevermind.&amp;nbsp; I fixed it.&amp;nbsp; I set this:&lt;/p&gt;
&lt;p&gt;xnUserName.SetValue(currentUser);&lt;/p&gt;
&lt;p&gt;to this:&lt;/p&gt;
&lt;p&gt;xnUserName.SetValue(&amp;quot;&lt;font color="#800000"&gt;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt; &amp;quot;);&lt;/p&gt;
&lt;p&gt;and it worked fine.&amp;nbsp; Thanks a bunch for the help!&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35677.aspx</link><pubDate>Thu, 11 Dec 2008 14:51:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35677</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35677.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35677</wfw:commentRss><description>&lt;p&gt;Sorry to be dense....if my code is like this:&lt;/p&gt;
&lt;p&gt;XPathNavigator xn = this.MainDataSource.CreateNavigator(); &lt;br /&gt;XPathNavigator xnUserName = xn.SelectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt;&amp;quot;, this.NamespaceManager);&lt;/p&gt;
&lt;p&gt;xnUserName.SetValue(currentUser);&lt;/p&gt;
&lt;p&gt;I get build errors:&lt;/p&gt;
&lt;p&gt;the name &amp;#39;CurrentUser&amp;#39; does not exist in the curretn context.&lt;/p&gt;
&lt;p&gt;if my code looks like this:&lt;/p&gt;
&lt;p&gt;XPathNavigator xn = this.MainDataSource.CreateNavigator(); &lt;br /&gt;XPathNavigator xnUserName = xn.SelectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt;&amp;quot;, this.NamespaceManager);&lt;/p&gt;
&lt;p&gt;The build works, but nothing happens in the form.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35675.aspx</link><pubDate>Thu, 11 Dec 2008 14:38:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35675</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35675.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35675</wfw:commentRss><description>&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;Remove the line that uses System.&lt;font color="#008080" size="2"&gt;Environment&lt;/font&gt;&lt;font size="2"&gt;.UserName&amp;nbsp;from your code&lt;/font&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Place a button on the form in the designer.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Double-click the button.&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click Rules...&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click Add...&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click Add action...&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Select &amp;quot;Set a field&amp;#39;s value&amp;quot;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Select the &lt;font color="#800000" size="2"&gt;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt; field&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click the &lt;em&gt;fx&lt;/em&gt; button&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click Insert function...&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Select &amp;quot;All&amp;quot;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Scroll down and Select userName&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click OK 6 times.&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35674.aspx</link><pubDate>Thu, 11 Dec 2008 14:21:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35674</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35674.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35674</wfw:commentRss><description>&lt;p&gt;Sorry about the confusion on the 2003 thing.&amp;nbsp; I have to use strictly C# - no 2003 OM.&amp;nbsp; Is it possible to do without full trust?&amp;nbsp; Full trust is not an option.&amp;nbsp; Too many complications in my deployment - we are on an intranet/extranet without VPN or anything - no certificates, etc.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;quot;Your form probably needs to be full trust to access System.Environment, but you should be able to get the user name by setting up a rule to copy the value of the userName() function to a field and then querying that field from the code.&amp;quot;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Not sure that I am following you here.&amp;nbsp; I dont think that I am able to get the username before it throws the security error.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35672.aspx</link><pubDate>Thu, 11 Dec 2008 14:12:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35672</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35672.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35672</wfw:commentRss><description>&lt;p&gt;You can use C# with the 2003 OM&amp;nbsp;(note my previous post saying to select &amp;quot;&lt;em&gt;C# (2003 Object Model)&amp;quot;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;But the 2007 one is just as good, if not better.&amp;nbsp; My guess is that you are getting that error because of this line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;System.&lt;font color="#008080" size="2"&gt;Environment&lt;/font&gt;&lt;font size="2"&gt;.UserName;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Your form probably needs to be full trust to access System.Environment, but you should be able to get the user name by setting up a rule to copy the value of the userName() function to a field and then querying that field from the code.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35671.aspx</link><pubDate>Thu, 11 Dec 2008 14:04:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35671</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35671.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35671</wfw:commentRss><description>&lt;p&gt;Hello Jimmy.&amp;nbsp; I can&amp;#39;t use the 2003 OM as I have a ton of code that requires C#.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35670.aspx</link><pubDate>Thu, 11 Dec 2008 14:03:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35670</guid><dc:creator>BuildPro Guru</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35670.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35670</wfw:commentRss><description>&lt;p&gt;Hello Anuma and thank you for your response.&amp;nbsp; I tried the code you provided and I got this error:&lt;/p&gt;
&lt;p&gt;System.Security.SecurityException was unhandled by user code&lt;br /&gt;&amp;nbsp; Message=&amp;quot;Request for the permission of type &amp;#39;System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&amp;#39; failed.&amp;quot;&lt;br /&gt;&amp;nbsp; Source=&amp;quot;mscorlib&amp;quot;&lt;br /&gt;&amp;nbsp; StackTrace:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp;amp; stackMark, Boolean isPermSet)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Security.CodeAccessPermission.Demand()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Environment.get_UserName()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Customer_Care___no_code.FormCode.FormEvents_Loading(Object sender, LoadingEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnLoad(DocReturnEvent pEvent)&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Is this telling me that I need to set my form to full trust?&amp;nbsp; That isn&amp;#39;t possible for me.&amp;nbsp; Is there another way?&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35669.aspx</link><pubDate>Thu, 11 Dec 2008 13:55:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35669</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35669.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35669</wfw:commentRss><description>&lt;p&gt;If you would like to try programming with the InfoPath 2003 object model and try out the code involving thisXDocument that you seem to be finding, you can switch to that by going to Tools-&amp;gt;Form Options-&amp;gt;Programming, clicking Remove Code and selecting &lt;em&gt;C# (2003 Object Model)&lt;/em&gt;.&lt;/p&gt;</description></item><item><title>Re: thisxdocument error</title><link>https://www.infopathdev.com:443/forums/thread/35661.aspx</link><pubDate>Thu, 11 Dec 2008 13:30:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35661</guid><dc:creator>Anuma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35661.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35661</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thisxdocument will not work in the infopath2007. Can you try below code.&lt;/p&gt;
&lt;p&gt;XPathNavigator xn = this.MainDataSource.CreateNavigator(); &lt;br /&gt;XPathNavigator xnUserName = xn.SelectSingleNode(&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields/d:Buyers/d:WorkOrders/@ALCOUN&lt;/font&gt;&amp;quot;, this.NamespaceManager);&lt;/p&gt;
&lt;p&gt;string currentUser = System.Environment.UserName.ToString(); &lt;br /&gt;xnUserName.SetValue(currentUser);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>