Retrieving the Logged On UserName in a Form - InfoPath Dev
in

InfoPath Dev

Retrieving the Logged On UserName in a Form

Last post 03-11-2006 04:56 AM by ek38. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-10-2006 08:10 AM

    • ek38
    • Top 200 Contributor
    • Joined on 02-14-2006
    • Posts 54

    Retrieving the Logged On UserName in a Form

    We have been trying to figure this out for a couple of days and don't have the best solution yet. There HAS to be an easy way to do this. It is such a basic concept.

    We want to capture the Logged On Username (Active Directory) automatically and place it on the form. We have successfully done this on the Form Open using the following code in JavaScript.

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

    The problem is that we get a warning "An ActiveX control on this page might be unsafe to interact.." EVERYTIME someone opens a form. We have not found out how to eliniate the warning message.

    We don't want to do a controlled form.
    We don't want to have to write 50 lines of code

    Is there an easier way to get the Username? This should be a built in function of Infopath.

    Can someone tell us how to get rid of the "ActiveX Message"?
  • 03-10-2006 11:40 PM In reply to

    Re: Retrieving the Logged On UserName in a Form

    Hi,
    If it is the script then using ActiveX control needs full trust to your form. There are two ways to continue here,
    1. Use .net as your code behind and there you don't need full trust to get logged in username.
    2. Use AD service webservice to get the loggedIn user details.
  • 03-11-2006 04:56 AM In reply to

    • ek38
    • Top 200 Contributor
    • Joined on 02-14-2006
    • Posts 54

    Re: Retrieving the Logged On UserName in a Form

    Thanks for replying Agni.

    I don't know how to use .Net instead of using the Java script code, but I should probably look into that.

    However, yesterday, we tried the ADService Webservice and it worked beautifully. We should have done that 3 days ago in stead of spending all the time trying to figure it out ourselves.

    I still think future releases of Infopath, should have the logged on username as a function, similar to how the "Now()" function can be used.
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.