<?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: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14510.aspx</link><pubDate>Sat, 10 Mar 2007 10:25:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14510</guid><dc:creator>jacobus.vorster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14510.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14510</wfw:commentRss><description>Hi Patrick,&lt;br /&gt;&lt;br /&gt;InfoPath 2003.&lt;br /&gt;&lt;br /&gt;Thanks</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14509.aspx</link><pubDate>Fri, 09 Mar 2007 21:31:29 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14509</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14509.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14509</wfw:commentRss><description>Hi Cobus,&lt;br /&gt;Are you running InfoPath 2007 or InfoPath 2003?</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14508.aspx</link><pubDate>Fri, 09 Mar 2007 11:00:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14508</guid><dc:creator>jacobus.vorster</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14508.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14508</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;I want to get the username of the logged in user, but when I run the code the following code I get this error message: Automation server can't create object&lt;br /&gt;-------------------------------------------------------------------------------&lt;br /&gt;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;//Create a WScript.Network object, which provides access to the user data&lt;br /&gt;var objNetwork = new ActiveXObject("WScript.network");&lt;br /&gt;&lt;br /&gt;//Retrieve the UserName and write it into the my:RequestedBy field &lt;br /&gt;XDocument.DOM.selectSingleNode("/my:myFields/my:dataFields/my:PIRRequest/my:RequestedBy").text = &lt;br /&gt;objNetwork.UserName;&lt;br /&gt;}&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;Any help will be greatly appriciated:)&lt;br /&gt;</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14507.aspx</link><pubDate>Fri, 12 May 2006 20:09:06 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14507</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14507.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14507</wfw:commentRss><description>Mary_l - I was able to get this done and working finally.  It is a "round about" solution but it works.  1) We currently have a view in the Sharepoint db (_PROF)that gathers the necessary information that AD shares with this db, ie. Preferred Name, Department, Phone, etc.... this is used as a secondary data source in the form.  2) I then created a view in our Sharepoint database (_SITE) that joins Sites and UserInfo - and am using this as a secondary data source in InfoPath as well - I needed this view because capitalization was not consistent in the first view I mentioned.  3)I added 3 fields to my SQL db and converted the main data source to include these in the form - Domain, UserId, and DomainUserId. 4) Dropped the new fields as text boxes on the form and used conditional formatting to hide them when they are not blank. 5) I used the following jscript behind the form:&lt;br /&gt;&lt;br /&gt;//******************************************************************&lt;br /&gt;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;//Only load data if the fields are empty.&lt;br /&gt;if (XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:PIRRequest/@RequestedBy").text == "" )&lt;br /&gt;&lt;br /&gt;//Create a WScript.Network object, which provides access to user data&lt;br /&gt;var objNetwork = new ActiveXObject("WScript.network");&lt;br /&gt;&lt;br /&gt;//Retrieve the Domain &amp; UserName and write into Domain &amp; UserId fields &lt;br /&gt;XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:PIRRequest/@Domain").text = &lt;br /&gt;objNetwork.UserDomain;&lt;br /&gt;XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:PIRRequest/@UserId").text = &lt;br /&gt;objNetwork.UserName;&lt;br /&gt;}&lt;br /&gt;//******************************************************************&lt;br /&gt;&lt;br /&gt;6) Created a rule in the UserId field to set the DomainUserId text field value - a value that concatenates Domain and User Id text field values (concat(@Domain, "\", .).&lt;br /&gt;7) Created a rule in the DomainUserId field that set the value of the RequestedBy (where I wanted a full name) text field to -  function - @tp_Title[@tp_Login = @DomainUserId]&lt;br /&gt;@tp_Title (ex: Smith, Natalie) from the sharepoint view&lt;br /&gt;@tp_Login (ex: Domain\nsmith) from the sharepoint view&lt;br /&gt;@DomainUserId will have the concatenated version (Domain\nsmith)&lt;br /&gt;8) Created rules in the DomainUserId field that set the values of RequestorDept and Phone text fields as well. &lt;br /&gt;functions - @Dept[@PreferredName = @RequestedBy]&lt;br /&gt;functions - @Phone[@PreferredName = @RequestedBy]&lt;br /&gt;@Phone, @PreferredName, and @Dept from the other sharepoint view w/ AD information&lt;br /&gt;&lt;br /&gt;Like I said "round about" way to the solution....but it was all I could get to work especially with my limited knowledge of coding and limited timeframe!  Part of the process (like the concatenation part) could have been shortened if I could have included this vbscript:&lt;br /&gt;*****************************************************************&lt;br /&gt;Sub XDocument_OnLoad(eventObj)&lt;br /&gt;    Set oWshNet = CreateObject("WScript.Network") &lt;br /&gt;    sDomain = oWshNet.UserDomain &lt;br /&gt;    sUserName = oWshNet.UserName &lt;br /&gt; &lt;br /&gt;    Set objField1 = XDocument.DOM.selectSingleNode("/my:myFields/my:fieldName")&lt;br /&gt;    objField1.text = sDomain &amp; "\" &amp; sUserName&lt;br /&gt;End Sub&lt;br /&gt;****************************************************************&lt;br /&gt;&lt;br /&gt;However, my form was already locked into jscript and I wasn't even trying to figure that one out!&lt;br /&gt;&lt;br /&gt;If you need any clarification, let me know. Thanks.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14506.aspx</link><pubDate>Fri, 12 May 2006 14:00:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14506</guid><dc:creator>nukkumatti</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14506.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14506</wfw:commentRss><description>Hey guys take a look here, I think this should help you out or at least point you to the right direction.&lt;br /&gt;&lt;br /&gt;&lt;a href='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2328 ' target='_blank' title='http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2328 '&lt;a target="_blank" href=http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2328&gt;http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2328&lt;/a&gt; &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers it's weekend now !</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14505.aspx</link><pubDate>Thu, 11 May 2006 13:12:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14505</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14505.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14505</wfw:commentRss><description>No, unfortunately I haven't been able to get anything else to work.  I even had an experienced programmer work on an Active Directory web service yesterday and he couldn't get anything to work either. Not surprising - because with this product it seems everything I've tried to do has been challenging. I have one more thing to try - I'll let you know how it turns out.</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14504.aspx</link><pubDate>Thu, 11 May 2006 12:55:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14504</guid><dc:creator>mary_l</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14504.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14504</wfw:commentRss><description>Hi! &lt;br /&gt;Did you solve the problem with showing the displayname in a field? I have exactly the same problem as you, i get the username, but dont know get the displayname to show.</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14503.aspx</link><pubDate>Tue, 02 May 2006 20:13:17 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14503</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14503.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14503</wfw:commentRss><description>I was meaning to populate text fields with Display Name, department, phone number (Active Directory attributes).</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14502.aspx</link><pubDate>Tue, 02 May 2006 06:11:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14502</guid><dc:creator>uma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14502.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14502</wfw:commentRss><description>Yes, you can do the things like populating the data(display name, dept name, phone number, email ID) based on selected data(User Name) using secondary data source connection.  For the details see the given link.&lt;br /&gt;&lt;br /&lt;a target="_blank" href=http://infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85&gt;http://infopathdev.com/howto/tutorials/default.aspx?i=9111ef580f95479890fc18fb2c5bac85&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I hope, it is what you want..&lt;br /&gt;</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14501.aspx</link><pubDate>Mon, 01 May 2006 16:07:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14501</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14501.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14501</wfw:commentRss><description>I can get the user id to prepopulate just fine with the code below.  Now of course I need to use a recognizable name such as John Smith rather than user id jsmith.  Plus I need to pull in the users department name and phone number, email etc. When I tried to replace "UserName" with "displayName" below (as what I see being the attribute in AD....it doesn't work.  As well as if I add another line under username with department....doesn't work.  Is this possible to do and how?&lt;br /&gt;&lt;br /&gt;*****************************************************************&lt;br /&gt;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;//Only load data if the fields are empty.&lt;br /&gt; if (XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:PIRRequest/@RequestedBy").text == "" )&lt;br /&gt;&lt;br /&gt;//Create a WScript.Network object, which provides access to the user data&lt;br /&gt;var objNetwork = new ActiveXObject("WScript.network");&lt;br /&gt;&lt;br /&gt;//Retrieve the UserName and write it into the my:RequestedBy field &lt;br /&gt;XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:PIRRequest/@RequestedBy").text = &lt;br /&gt;objNetwork.UserName;&lt;br /&gt;}</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14500.aspx</link><pubDate>Wed, 26 Apr 2006 19:20:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14500</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14500.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14500</wfw:commentRss><description>Thank you, now it is working perfectly!</description></item><item><title>Re: Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/14499.aspx</link><pubDate>Wed, 26 Apr 2006 07:11:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14499</guid><dc:creator>uma</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14499.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14499</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;In the InfoPath while mentioning the XPath for a field you have to give the xpath correctly by mentioning the correct name spaces. And "my" is not the namespace for all the fields, some times it is different depending on the name space setting.&lt;br /&gt;&lt;br /&gt;I can't give the correct xpath by seeing the details which u mentioned, but, one way to solve your problem is, open the template.xml file in the text editor Or in the visiual studio editor and see for the namespace of the each and every field. And replace the “my”(in the xpath which you mentioned above) with the correct namespace which you find in the template.xml file.&lt;br /&gt;&lt;br /&gt;Hope, this will help you to solve your problem.&lt;br /&gt;</description></item><item><title>Inserting Login username into text field</title><link>https://www.infopathdev.com:443/forums/thread/12849.aspx</link><pubDate>Tue, 25 Apr 2006 21:43:21 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12849</guid><dc:creator>nwillis</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12849.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12849</wfw:commentRss><description>I'm very new to InfoPath and I have seen many items about how to do this.  We've gotten it to work doing a MS Lab by referencing the path ("/my:myFields/my:RequestedBy). However the actual data connection that has been set up has a different structure and I've tried all sorts of combinations for the path thinking one would work.  When you look at the data source it has myFields/dataFields/d:PIRRequest/:RequestedBy.  I'm not sure what the d: means. I'm inserting the following script into my form and am unable to get it to work - Can anyone provide any help??:&lt;br /&gt;&lt;br /&gt;*****************************************************&lt;br /&gt;function XDocument::OnLoad(eventObj)&lt;br /&gt;{&lt;br /&gt;//Create a WScript.Network object, which provides access to the user data&lt;br /&gt;var objNetwork = new ActiveXObject("WScript.network");&lt;br /&gt;&lt;br /&gt;//Retrieve the UserName and write it into the my:RequestedBy field &lt;br /&gt;XDocument.DOM.selectSingleNode("/my:myFields/my:dataFields/my:PIRRequest/my:RequestedBy").text = &lt;br /&gt;objNetwork.UserName;&lt;br /&gt;}&lt;br /&gt;**************************************************</description></item></channel></rss>