<?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: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/70478.aspx</link><pubDate>Wed, 21 Sep 2011 11:39:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:70478</guid><dc:creator>Wheels</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/70478.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=70478</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t particually care for InfoPath or Access to much. I do C#.NET, SQL Server, and Teradata these days. It is really difficult to recall what I did two years ago, but I recall something about setting the form as Fully Trusted. I hope that helps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I found the following post relating to a Trusted form and user name: &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/sharepointinfopath/thread/705c108d-e945-46bb-80d5-ece8106dada8"&gt;http://social.msdn.microsoft.com/Forums/en-US/sharepointinfopath/thread/705c108d-e945-46bb-80d5-ece8106dada8&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;WHEELS&lt;/p&gt;</description></item><item><title>Re: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/70445.aspx</link><pubDate>Tue, 20 Sep 2011 18:48:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:70445</guid><dc:creator>stara</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/70445.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=70445</wfw:commentRss><description>&lt;p&gt;Were you able to get the user name after the form was published? It works for me only in the Preview, but nothing happens when form is published.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let me know.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/70421.aspx</link><pubDate>Mon, 19 Sep 2011 17:15:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:70421</guid><dc:creator>Wheels</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/70421.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=70421</wfw:commentRss><description>&lt;p&gt;Hi Stara.&lt;/p&gt;
&lt;p&gt;I was able to resolve this issue, and haven&amp;#39;t worked on it for years (doesn&amp;#39;t seem that long ago).&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not entirely sure what you are trying to do, but I&amp;#39;ll give it my best shot:&lt;/p&gt;
&lt;p&gt;My code is as follows:&lt;/p&gt;
&lt;p&gt;Sub XDocument_OnLoad(eventObj) &lt;/p&gt;
&lt;p&gt;Dim objNet On Error Resume Next &amp;#39;In case we fail to create object then display our custom error &lt;/p&gt;
&lt;p&gt;Set objNet = CreateObject(&amp;quot;WScript.NetWork&amp;quot;) Dim strInfo Dim userName2 XDocument.DisplayAlerts = False &lt;/p&gt;
&lt;p&gt;strInfo = objNet.UserName XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:LANUserID&amp;quot;).Text = strInfo&lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;I derived the user name (in my company it is a code like ABCDE), and then used the variable in an SQL --&amp;gt; Access query to resolve the ID into a actual name. I have also done this by automating to Outlook (in other&amp;nbsp; (VBA) projects). I&amp;#39;m sure you could tie the Function to run off the submit button on your form.&lt;/p&gt;
&lt;p&gt;WHEELS&lt;/p&gt;</description></item><item><title>Re: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/70413.aspx</link><pubDate>Mon, 19 Sep 2011 14:41:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:70413</guid><dc:creator>stara</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/70413.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=70413</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Were you able to resolve this issue? Beacuse I&amp;#39;m trying to do the same and it doesn&amp;#39;t work after the form is published. I have it in the on_load event. It works well when I try in the design to Preview form mode. I would like to capture user name once the form is submitted.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Stara&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/42844.aspx</link><pubDate>Fri, 12 Jun 2009 11:42:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42844</guid><dc:creator>Wheels</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42844.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42844</wfw:commentRss><description>&lt;p&gt;Hi Patrick.&lt;/p&gt;
&lt;p&gt;I had this code in the form laod event:&lt;/p&gt;
&lt;p&gt;Sub XDocument_OnLoad(eventObj)&lt;br /&gt;&amp;#39;line 20&lt;br /&gt;Dim objNet&lt;br /&gt;On Error Resume Next &amp;#39;In case we fail to create object then display our custom error&lt;br /&gt;Set objNet = CreateObject(&amp;quot;WScript.NetWork&amp;quot;) &lt;br /&gt;&amp;nbsp;&lt;br /&gt;Dim strInfo&lt;br /&gt;strInfo = objNet.UserName&lt;br /&gt;XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:LANUserID&amp;quot;).Text = strInfo&lt;br /&gt;&amp;#39;XDocument.UI.Alert(strInfo)&lt;br /&gt;XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:TestLANID&amp;quot;).Text = XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:LANUserID&amp;quot;).Text&lt;br /&gt;&amp;#39;strInfo = &amp;quot;User Name is&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;quot; &amp;amp; objNet.UserName &amp;amp; vbCRLF &amp;amp; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;&amp;quot;Computer Name is &amp;quot; &amp;amp; objNet.ComputerName &amp;amp; vbCRLF &amp;amp; _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; &amp;quot;Domain Name is&amp;nbsp;&amp;nbsp; &amp;quot; &amp;amp; objNet.UserDomain&lt;br /&gt;&amp;#39;MsgBox strInfo&lt;/p&gt;
&lt;p&gt;Set objNet = Nothing&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Destroy the Object to free the Memory&lt;/p&gt;
&lt;p&gt;End Sub&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;but now I call it from the form laod as follows:&lt;/p&gt;
&lt;p&gt;Sub XDocument_OnLoad(eventObj)&lt;/p&gt;
&lt;p&gt;UserName&lt;br /&gt;End Sub&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/42803.aspx</link><pubDate>Thu, 11 Jun 2009 21:12:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42803</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42803.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42803</wfw:commentRss><description>&lt;p&gt;Hi Wheels,&lt;/p&gt;
&lt;p&gt;Well, are you calling the new subroutine? Since I can&amp;#39;t see the rest of your code, I have no way of debugging it. Just adding this routine won&amp;#39;t result in it working since something has to call it.&lt;/p&gt;</description></item><item><title>InfoPath 2003 VBScript capture user name and populate field issue</title><link>https://www.infopathdev.com:443/forums/thread/42774.aspx</link><pubDate>Thu, 11 Jun 2009 15:38:55 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:42774</guid><dc:creator>Wheels</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/42774.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=42774</wfw:commentRss><description>&lt;p&gt;Good morning all.&lt;/p&gt;
&lt;p&gt;I created a little test project to capture a user name in VBScript. It all works well, but when I pasted the code in the &amp;quot;big&amp;quot; project, the user name will not populate the User Name field(s).&lt;/p&gt;
&lt;p&gt;Has anyone out there experienced this phenomenon?&lt;/p&gt;
&lt;p&gt;My code is a follows:&lt;/p&gt;
&lt;p&gt;&amp;lt;code&amp;gt;&lt;/p&gt;
&lt;p&gt;Public Sub UserName() &lt;/p&gt;
&lt;p&gt;Dim objNet &lt;/p&gt;
&lt;p&gt;On Error Resume Next &amp;#39;In case we fail to create object then display our custom error &lt;/p&gt;
&lt;p&gt;Set objNet = CreateObject(&amp;quot;WScript.NetWork&amp;quot;) &lt;/p&gt;
&lt;p&gt;Dim strInfo strInfo = objNet.UserName &lt;/p&gt;
&lt;p&gt;XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:LANUserID&amp;quot;).Text = strInfo&amp;nbsp;&lt;/p&gt;
&lt;p&gt;XDocument.DOM.selectSingleNode(&amp;quot;dfs:myFields/my:TestLANID&amp;quot;).Text = strInfo&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Set objNet = Nothing &amp;#39;Destroy the Object to free the Memory &lt;/p&gt;
&lt;p&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;lt;/code&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Any ideas?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thank you, WHEELS&lt;/p&gt;</description></item></channel></rss>