How to get username in a InfoPath 2003 form? - InfoPath Dev
in

InfoPath Dev

How to get username in a InfoPath 2003 form?

Last post 02-18-2009 07:30 AM by swathip. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-17-2009 08:08 AM

    How to get username in a InfoPath 2003 form?

    Hello,
    I found the following code example in order to get the username the user who opened the form:

    function XDocument::OnLoad(eventObj) {
     //Create a WScript.Network object, which provides access to the user data
    var objNetwork = new ActiveXObject("WScript.network");

    //Retrieve the UserName and write it into the my:UserName field
    XDocument.DOM.selectSingleNode("/my:meineFelder/my:Username").text = objNetwork.UserName;
    }

    For testing I created a simple InfoPath form as you can see though the template.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:Code:-myXSD-2009-02-17T15-22-18" href="manifest.xsf" solutionVersion="1.0.0.1" productVersion="12.0.0" PIVersion="1.0.0.0" ?>
    <?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.2"?>
    <my:meineFelder xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-02-17T15:22:18">
     <my:Username></my:Username>
    </my:meineFelder>

    When I open the preview I get the following message:
    A runtime error occured.
    ...
    Automation server can't create object
    File: script.js

    What did I do wrong? How do I have to set up the form options?
    Thank you very much indeed for helping me.

  • 02-18-2009 07:30 AM In reply to

    Re: How to get username in a InfoPath 2003 form?

    Hi,

    Once go through the below link.

    http://www.infopathdev.com/forums/t/10170.aspx

     

     

    Swathip
    www.ggktech.com
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.