How to detect NT Username/Logon ID in Infopath?

J

Jonathan Gill

Does anyone know of a way to detect a person's NT Username/logon ID on an
Infopath form?

I would like to read this information directly from Infopath to pass into an
internal web service and return that output to the form.
 
A

Art

You need to set up a web service from Active Directory and then create a WSDL
connection to retreive the data.
 
J

Jonathan Gill

When a person opens an Infopath form how do you gather the current user's NT
Logon information?

Even with a web service to Active Directory wouldn't you need to pass
identifying information such as e-mail address or something else to get
output.

The equivalent of something like Request.ServerVariables("LOGON_USER") from
VBScript (our form uses Javascript as the code behind in Infopath though)?

Request.ServerVariables("LOGON_USER") would return something like
microsoft/bgates on a ASP page.

I am looking to obtain this informatin on an Infopath form when the user
opens it from a SharePoint form library.
 
J

J Galloway

In IP2007, it's simple.

1) Create a new textbox control
2) Go to it's properties
2) In the "default value" box, put "userName()" (no quotes)

OK out and preview the form, you should see the username you logged into
your computer with displayed in the textbox.

You can also find the userName() function by clicking the fX button next to
the default value box, going to "all" functionals, and scrolling down the
list to userName()

Hope this helps!
 
J

J Galloway

In IP2003, you can use the webservice/secondary data source as above, or try
this bit of script:

var objWscript;

objWscript = new ActiveXObject("WScript.Network");
XDocument.UI.Alert(objWscript.username);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top