<?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: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47253.aspx</link><pubDate>Tue, 22 Sep 2009 21:00:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47253</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47253.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47253</wfw:commentRss><description>&lt;p&gt;You don&amp;#39;t have to have an &amp;#39;else&amp;#39; statement. I had assumed you were using that for some kind of debugging? Just remove your &amp;#39;else&amp;#39; that has the message box with the error. It seems to me that you have decent error handling in your if block -- you return an error if the user isn&amp;#39;t in AD or if something goes awry in your try block....&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47250.aspx</link><pubDate>Tue, 22 Sep 2009 19:29:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47250</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47250.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47250</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes, sorry i did have == I guess I deleted that accidently.&amp;nbsp; I can run the code without errors but it returns my &lt;/p&gt;&lt;p&gt;else MessageBox.Show(&amp;quot;Error&amp;quot;)&lt;/p&gt;&lt;p&gt;when I open the form and the LastNameNav is blank (Previewing the form).&amp;nbsp; I may have to abandon this cause I&amp;#39;ve spent hours trying to make this simple condition work (which is very important otherwise the originator data will be overwritten).&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47221.aspx</link><pubDate>Mon, 21 Sep 2009 21:53:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47221</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47221.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47221</wfw:commentRss><description>&lt;p&gt;Hi -- a single = sign is used to set a value. Basically, in your if statement, you are setting the value of LastName to null. Use &amp;#39;==&amp;#39;. &lt;/p&gt;
&lt;p&gt;Do you know how to set a break point and run your code in debug mode? Are you using Visual Studio or VSTA (comes with InfoPath)?&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47220.aspx</link><pubDate>Mon, 21 Sep 2009 21:13:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47220</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47220.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47220</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;God I must be thick in the head.&amp;nbsp; Like you said, yes I would like to check one field only to see if it&amp;#39;s blank then proceed accordingly.&amp;nbsp; I understand this is a coding question moreso than Infopath and I&amp;#39;m greatful for the continued help.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;I tried it like this but it always pops up my &amp;quot;error&amp;quot; window even on the first time opening the form.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;XPathNavigator xnMyForm = this.CreateNavigator();&lt;br /&gt;            XmlNamespaceManager ns = this.NamespaceManager;&lt;br /&gt;            XPathNavigator LastNameNav = xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:LastName&amp;quot;, ns);&lt;br /&gt;            if (LastNameNav = null)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;               try&lt;br /&gt;                {&lt;br /&gt;                    // Get the user name of the current user.&lt;br /&gt;                    string userName = this.Application.User.UserName;&lt;br /&gt;&lt;br /&gt;                    // Create a DirectorySearcher object using the user name &lt;br /&gt;                    // as the LDAP search filter. If using a directory other&lt;br /&gt;                    // than Exchange, use sAMAccountName instead of mailNickname.&lt;br /&gt;                    DirectorySearcher searcher = new DirectorySearcher(&lt;br /&gt;                       &amp;quot;(mailNickname=&amp;quot; + userName + &amp;quot;)&amp;quot;);&lt;br /&gt;&lt;br /&gt;                    // Search for the specified user.&lt;br /&gt;                    SearchResult result = searcher.FindOne();&lt;br /&gt;&lt;br /&gt;                    // Make sure the user was found.&lt;br /&gt;                    if (result == null)&lt;br /&gt;                    {&lt;br /&gt;                        MessageBox.Show(&amp;quot;Error finding user: &amp;quot; + userName);&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        // Create a DirectoryEntry object to retrieve the collection&lt;br /&gt;                        // of attributes (properties) for the user.&lt;br /&gt;                        DirectoryEntry employee = result.GetDirectoryEntry();&lt;br /&gt;&lt;br /&gt;                        // Assign the specified properties to string variables.&lt;br /&gt;                        string FirstName = employee.Properties[&lt;br /&gt;                           &amp;quot;givenName&amp;quot;].Value.ToString();&lt;br /&gt;                        string LastName = employee.Properties[&amp;quot;sn&amp;quot;].Value.ToString();&lt;br /&gt;                        string Mail = employee.Properties[&amp;quot;mail&amp;quot;].Value.ToString();&lt;br /&gt;                        string Location = employee.Properties[&lt;br /&gt;                           &amp;quot;physicalDeliveryOfficeName&amp;quot;].Value.ToString();&lt;br /&gt;                        string Title = employee.Properties[&amp;quot;title&amp;quot;].Value.ToString();&lt;br /&gt;                        string Phone = employee.Properties[&lt;br /&gt;                           &amp;quot;telephoneNumber&amp;quot;].Value.ToString();&lt;br /&gt;                        string Department = employee.Properties[&lt;br /&gt;                           &amp;quot;department&amp;quot;].Value.ToString();&lt;br /&gt;&lt;br /&gt;                        // The manager property returns a distinguished name, &lt;br /&gt;                        // so get the substring of the common name following &amp;quot;CN=&amp;quot;.&lt;br /&gt;                        //string ManagerName = employee.Properties[&lt;br /&gt;                        // &amp;quot;manager&amp;quot;].Value.ToString();&lt;br /&gt;                        // ManagerName = ManagerName.Substring(&lt;br /&gt;                        //3, ManagerName.IndexOf(&amp;quot;,&amp;quot;) - 3);&lt;br /&gt;&lt;br /&gt;                        &lt;br /&gt;                        // Set the fields in the form.&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:FirstName&amp;quot;, ns)&lt;br /&gt;                           .SetValue(FirstName);&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:LastName&amp;quot;, ns)&lt;br /&gt;                           .SetValue(LastName);&lt;br /&gt;                        //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Alias&amp;quot;, ns)&lt;br /&gt;                        //.SetValue(userName);&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Email&amp;quot;, ns)&lt;br /&gt;                           .SetValue(Mail);&lt;br /&gt;                        //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Manager&amp;quot;, ns)&lt;br /&gt;                        //.SetValue(ManagerName);&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpLocation/my:Office&amp;quot;, ns)&lt;br /&gt;                           .SetValue(Location);&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Title&amp;quot;, ns)&lt;br /&gt;                           .SetValue(Title);&lt;br /&gt;                        xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Phone&amp;quot;, ns)&lt;br /&gt;                           .SetValue(Phone);&lt;br /&gt;                        //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Department&amp;quot;, ns)&lt;br /&gt;                        //.SetValue(Department);&lt;br /&gt;&lt;br /&gt;                        // Clean up.&lt;br /&gt;                        xnMyForm = null;&lt;br /&gt;                        searcher.Dispose();&lt;br /&gt;                        result = null;&lt;br /&gt;                        employee.Close();&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;                catch (Exception ex)&lt;br /&gt;                {&lt;br /&gt;                    MessageBox.Show(&amp;quot;The following error occurred: &amp;quot; +&lt;br /&gt;                       ex.Message.ToString());&lt;br /&gt;                    throw;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            else { MessageBox.Show(&amp;quot;Error&amp;quot;); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47219.aspx</link><pubDate>Mon, 21 Sep 2009 19:08:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47219</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47219.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47219</wfw:commentRss><description>&lt;p&gt;Ah, okay, you are using the InfoPath 2007 Object Model.&lt;/p&gt;
&lt;p&gt;To check for blank, you can do something like:&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#008000"&gt;// Create an XPathNavigator to walk the main data source&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#008000"&gt;// of the form.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;XPathNavigator&lt;/font&gt; xnMyForm = &lt;font color="#0000ff"&gt;this&lt;/font&gt;.CreateNavigator();&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;XmlNamespaceManager&lt;/font&gt; ns = &lt;font color="#0000ff"&gt;this&lt;/font&gt;.NamespaceManager;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#008000"&gt;// Set the fields in the form.&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#008000"&gt;//check to see if the first name field is blank&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#2b91af"&gt;XPathNavigator&lt;/font&gt; firstNameNav = xnMyForm.SelectSingleNode(&lt;font color="#a31515"&gt;&amp;quot;/my:TrackChanges/my:GrpRequestor/my:FirstName&amp;quot;&lt;/font&gt;, ns);&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (&lt;font color="#0000ff"&gt;null&lt;/font&gt; != firstNameNav &amp;amp;&amp;amp; firstNameNav.Value.Equals(&lt;font color="#a31515"&gt;&amp;quot;&amp;quot;&lt;/font&gt;))&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;{&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:normal;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:0pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;firstNameNav.SetValue(FirstName);&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="LINE-HEIGHT:115%;MARGIN-TOP:0in;PADDING-LEFT:0in;PADDING-RIGHT:0in;MARGIN-BOTTOM:10pt;FONT-SIZE:11pt;"&gt;&lt;span style="FONT-SIZE:10pt;"&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;p&gt;Now, it may be enough to simply check to see if one field is blank first, like the Last Name field, and if it is, set all your values. That may be the best route -- after all, you might have a user who doesn&amp;#39;t have a phone number listed in AD, and you wouldn&amp;#39;t want to then be filling it with another user&amp;#39;s phone number simply because it was blank.&lt;/p&gt;
&lt;p&gt;In fact, I think given this scenario, I&amp;#39;d check for Last Name being blank at the beginning of my code, and not bother with creating the AD connection and all that if it wasn&amp;#39;t. &lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47217.aspx</link><pubDate>Mon, 21 Sep 2009 18:40:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47217</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47217.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47217</wfw:commentRss><description>&lt;p&gt;Yes, I see now this would have to be done in the code.&amp;nbsp; Alas I am not a coder, but do get the concept of the conditions.&amp;nbsp; I was able to use the following code from a blog and make it work for my use. &amp;nbsp; I&amp;#39;m not usually one for hand holding, but in this case I need it.&amp;nbsp; Is anyone able to help me with the specific issue here?&amp;nbsp; I want to check one field (LastName) to see if it&amp;#39;s blank, and continue if it is.&amp;nbsp; I just don&amp;#39;t know in C# how to reference the Infopath field properly.&lt;/p&gt;&lt;p&gt;I tried to add this:&lt;/p&gt;&lt;p&gt;&amp;nbsp;if (&amp;quot;/my:TrackChanges/my:GrpRequestor/my:LastName)&amp;quot; == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // complete the rest of the lookup&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre&gt;try&lt;br /&gt;            {&lt;br /&gt;                // Get the user name of the current user.&lt;br /&gt;                string userName = this.Application.User.UserName;&lt;br /&gt;&lt;br /&gt;                // Create a DirectorySearcher object using the user name &lt;br /&gt;                // as the LDAP search filter. If using a directory other&lt;br /&gt;                // than Exchange, use sAMAccountName instead of mailNickname.&lt;br /&gt;                DirectorySearcher searcher = new DirectorySearcher(&lt;br /&gt;                   &amp;quot;(mailNickname=&amp;quot; + userName + &amp;quot;)&amp;quot;);&lt;br /&gt;&lt;br /&gt;                // Search for the specified user.&lt;br /&gt;                SearchResult result = searcher.FindOne();&lt;br /&gt;&lt;br /&gt;                // Make sure the user was found.&lt;br /&gt;                if (result == null)&lt;br /&gt;                {&lt;br /&gt;                    MessageBox.Show(&amp;quot;Error finding user: &amp;quot; + userName);&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    // Create a DirectoryEntry object to retrieve the collection&lt;br /&gt;                    // of attributes (properties) for the user.&lt;br /&gt;                    DirectoryEntry employee = result.GetDirectoryEntry();&lt;br /&gt;&lt;br /&gt;                    // Assign the specified properties to string variables.&lt;br /&gt;                    string FirstName = employee.Properties[&lt;br /&gt;                       &amp;quot;givenName&amp;quot;].Value.ToString();&lt;br /&gt;                    string LastName = employee.Properties[&amp;quot;sn&amp;quot;].Value.ToString();&lt;br /&gt;                    string Mail = employee.Properties[&amp;quot;mail&amp;quot;].Value.ToString();&lt;br /&gt;                    string Location = employee.Properties[&lt;br /&gt;                       &amp;quot;physicalDeliveryOfficeName&amp;quot;].Value.ToString();&lt;br /&gt;                    string Title = employee.Properties[&amp;quot;title&amp;quot;].Value.ToString();&lt;br /&gt;                    string Phone = employee.Properties[&lt;br /&gt;                       &amp;quot;telephoneNumber&amp;quot;].Value.ToString();&lt;br /&gt;                    string Department = employee.Properties[&lt;br /&gt;                       &amp;quot;department&amp;quot;].Value.ToString();&lt;br /&gt;&lt;br /&gt;                    // The manager property returns a distinguished name, &lt;br /&gt;                    // so get the substring of the common name following &amp;quot;CN=&amp;quot;.&lt;br /&gt;                    //string ManagerName = employee.Properties[&lt;br /&gt;                    // &amp;quot;manager&amp;quot;].Value.ToString();&lt;br /&gt;                    // ManagerName = ManagerName.Substring(&lt;br /&gt;                    //3, ManagerName.IndexOf(&amp;quot;,&amp;quot;) - 3);&lt;br /&gt;&lt;br /&gt;                    // Create an XPathNavigator to walk the main data source&lt;br /&gt;                    // of the form.&lt;br /&gt;                    XPathNavigator xnMyForm = this.CreateNavigator();&lt;br /&gt;                    XmlNamespaceManager ns = this.NamespaceManager;&lt;br /&gt;&lt;br /&gt;                    // Set the fields in the form.&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:FirstName&amp;quot;, ns)&lt;br /&gt;                       .SetValue(FirstName);&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:LastName&amp;quot;, ns)&lt;br /&gt;                       .SetValue(LastName);&lt;br /&gt;                    //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Alias&amp;quot;, ns)&lt;br /&gt;                       //.SetValue(userName);&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Email&amp;quot;, ns)&lt;br /&gt;                       .SetValue(Mail);&lt;br /&gt;                    //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Manager&amp;quot;, ns)&lt;br /&gt;                    //.SetValue(ManagerName);&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpLocation/my:Office&amp;quot;, ns)&lt;br /&gt;                       .SetValue(Location);&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Title&amp;quot;, ns)&lt;br /&gt;                       .SetValue(Title);&lt;br /&gt;                    xnMyForm.SelectSingleNode(&amp;quot;/my:TrackChanges/my:GrpRequestor/my:Phone&amp;quot;, ns)&lt;br /&gt;                       .SetValue(Phone);&lt;br /&gt;                    //xnMyForm.SelectSingleNode(&amp;quot;/my:myFields/my:Department&amp;quot;, ns)&lt;br /&gt;                       //.SetValue(Department);&lt;br /&gt;&lt;br /&gt;                    // Clean up.&lt;br /&gt;                    xnMyForm = null;&lt;br /&gt;                    searcher.Dispose();&lt;br /&gt;                    result = null;&lt;br /&gt;                    employee.Close();&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(&amp;quot;The following error occurred: &amp;quot; +&lt;br /&gt;                   ex.Message.ToString());&lt;br /&gt;                throw;&lt;br /&gt;            }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47214.aspx</link><pubDate>Mon, 21 Sep 2009 16:58:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47214</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47214.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47214</wfw:commentRss><description>&lt;p&gt;If you are populating the fields in code, you&amp;#39;ll want to address this in code. Before you populate each field (Name, Address, etc) simply check to see if the field is blank first in your code. So, I&amp;#39;m guessing since you say an OnLoad event, you are using the IP 2003 object model, and you&amp;#39;d want to see if the .text for each field was equal to &amp;quot;&amp;quot; prior to filling it.&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47213.aspx</link><pubDate>Mon, 21 Sep 2009 16:33:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47213</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47213.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47213</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;Sorry....tombstone data I&amp;#39;m referring to Name, Address, Telephone, etc.&amp;nbsp; And yes, my OnLoad event runs code to populate these fields on the main datasource.&lt;/p&gt;&lt;p&gt;I guess I&amp;#39;m just really slow...what rule do I use on each of the fields I only want once?&amp;nbsp; Sorry if this is a simple question, I&amp;#39;m still new to form design. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47210.aspx</link><pubDate>Mon, 21 Sep 2009 16:04:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47210</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47210.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47210</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t know what &amp;#39;tombstone&amp;#39; information is? If you are getting information from a secondary data source and want to keep it with the form, you need to populate main data source fields with that information. Are you currently doing that? &lt;/p&gt;
&lt;p&gt;If so, I&amp;#39;d assume you have fields in your form&amp;#39;s main data source like &amp;#39;UserName&amp;#39; or &amp;#39;UserAlias&amp;#39;, etc. And that you would, using rules or code, fill those main data source fields when the form is first opened, is that what you are doing? All I&amp;#39;m suggesting is that if those main data source fields are not blank, you can assume they&amp;#39;ve already been populated (by the C# code you mention) and thus should not be overwritten the next time the saved xml is opened....&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47200.aspx</link><pubDate>Mon, 21 Sep 2009 13:24:47 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47200</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47200.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47200</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hello, and thank you for responding.&amp;nbsp; To be clear...an expression box will display the data pulled from the data source but won&amp;#39;t store it?&amp;nbsp; I just want to understand the concept.&amp;nbsp; The fields in question are &amp;quot;tombstone&amp;quot; information pulled from a Sharepoint list based on the current AD User using C# code.&amp;nbsp; I don&amp;#39;t want those fields updated after the first person opens the form.&amp;nbsp; I just create a rule?&amp;nbsp; I just don&amp;#39;t understand where the rule goes and on fields. &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47151.aspx</link><pubDate>Fri, 18 Sep 2009 22:39:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47151</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47151.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47151</wfw:commentRss><description>&lt;p&gt;I always just check to see if the field is blank. Sure, that won&amp;#39;t protect you if something goes wrong when the form is first created, but that&amp;#39;s what error handling is for... Don&amp;#39;t put any controls on the form that the user can change the info with, just use expression boxes for display. That way another user can&amp;#39;t clear something out.&lt;/p&gt;</description></item><item><title>Current User updated when opened later</title><link>https://www.infopathdev.com:443/forums/thread/47111.aspx</link><pubDate>Thu, 17 Sep 2009 16:27:26 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47111</guid><dc:creator>Sailor</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47111.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=47111</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;&lt;p&gt;I know I&amp;#39;m missing something VERY simple somewhere, but hey I&amp;#39;m a newbie.&amp;nbsp; Using some C# code to query AD to get current user info.&amp;nbsp; What method is required to ensure this isn&amp;#39;t updated when the form is opened to view later?&amp;nbsp; We want to capture the data when the form is created then lock those fields.&amp;nbsp; It&amp;#39;s got to be a rule or conditional formatting, but I&amp;#39;m just unsure. &amp;nbsp;&lt;/p&gt;&lt;p&gt;Can someone help me with this? &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>