getting log in id using JScript code. - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

getting log in id using JScript code.

Last post 09-19-2011 08:10 AM by stara. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 12-18-2007 12:03 PM

    getting log in id using JScript code.

    Is there a way to get log in id using JScript code?  I know there is a way using managed code...which I will use at a later date.
     

     
    Filed under: ,
  • 12-21-2007 10:21 AM In reply to

    Re: getting log in id using JScript code.

    If you are using InfoPAth 2003:

    var wshShell = new ActiveXObject("Wscript.Shell");
    var wshEnv = wshShell.Environment("Process");
    var username = wshEnv.Item("UserName");

     

    If you are using InfoPath 2007, the user name is built in. For example:

    * Insert a text box.
    * Right-click the text box and choose properties.
    * Click the Default Value function button
    * Click Insert Fucntion
    * Select the "All" category, and then scroll down and select the "userName" function.
    * Click OK 3 times.

  • 01-03-2008 07:54 AM In reply to

    Re: getting log in id using JScript code.

    This worked great for Infopath 2003...thank you very much.   Now I would like to take the user ID and get User Name.  Looking into options.

    Filed under:
  • 01-03-2008 09:30 AM In reply to

    Re: getting log in id using JScript code.

    User name is available to full trust forms. Otherwise, you will need to use a Web service to accomplish this.

  • 01-03-2008 04:44 PM In reply to

    Re: getting log in id using JScript code.

    Here's the one we sell:

    http://www.qdabra.com/en/products/ADWebService.aspx

    Patrick Halstead
    Project Manager at Qdabra
  • 02-06-2008 06:20 AM In reply to

    Re: getting log in id using JScript code.

    I am using InfoPath 2003 and have the following code to get user id. 

    var wshShell = new ActiveXObject("Wscript.Shell");
    var wshEnv = wshShell.Environment("Process");
    var username = wshEnv.Item("UserName");

     But I get a popup that reads...

    An ActiveX control on the page might be unsafe to interact with the other parts of the page.  Do you want to allow this interaction?

    Do you know how I can eliminate this popup?  I have updated my Security Custom Level on IE to enable ActiveX controls.

     

    Filed under:
  • 02-07-2008 04:45 PM In reply to

    Re: getting log in id using JScript code.

    Unfortunately, without a Web service, user information is a security issue. In managed code you can get the user alias without seucirty issues, and that's it. A Web service is needed if you want to get more detailed information.

  • 04-01-2009 05:08 AM In reply to

    Re: getting log in id using JScript code.

    Hi all, for getting the user ID in IP2003 I am using the following code:

    var wshShell = new ActiveXObject("Wscript.Shell");

     var wshEnv = wshShell.Environment("Process");

     var username = wshEnv.Item("UserName");

     var name = XDocument.DOM.selectSingleNode("/my:myFields/my:name");

     name.text = username;

    when I am designing the form, this method works perfectly with "preview". But after I save the form, or publish ot sharepoint it doesn't work. I have put the code inside On Load event, so that everytime the user opens he form, it records it user ID. I have read the forums here and I couldnt find any answer except this code or the Web Service you proposed. Can you give some answers or to direct me to a solution using Jscript ?

    Thank you in advance

    Svetoslav

  • 09-19-2011 08:10 AM In reply to

    • stara
    • Top 200 Contributor
    • Joined on 10-19-2010
    • Posts 54

    Re: getting log in id using JScript code.

    Hi,

     

    Were you able to get this to work? I'm experiencing similar issue? The method works perfectly with "preview" but not when form is published. Please help.

     

    Thanks,

    Stara

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.