Get User Name in a Form

J

Juli V.

Hello!
I've read everything in this newsgroup about the subject, but still can't
hadle with it!
Need help, please!!

I don't want to use Visual Studio .NET to create a Form (like in Lab #15 on
MSDN library), I want to write JScript inside InfoPath.
So I found a solution here:
In JScript:

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:myFields/my:UserName").text =
objNetwork.UserName;
//Retrieve the UserDomain and write it into the my:UserDomain field
XDocument.DOM.selectSingleNode("/my:myFields/my:UserDomain").text =
objNetwork.UserDomain;
//Retrieve the ComputerName and write it into the my:ComputerName field
XDocument.DOM.selectSingleNode("/my:myFields/my:ComputerName").text =
objNetwork.ComputerName;
}

But it doesn't work! This code stop working after the first string:
var objNetwork = new ActiveXObject("WScript.network");

I couldn't find nothing about "WScript.network" - I think such definition
doesn't exist. So I don't know how I can solve this problem!
Please, if I'm wrong and somebody know a solution, point me on it!

thnx!
 
J

Juli V.

Oh! That's all! I've done it! My problem was in security. I've set my form
to Full Trust and everything is ok now!

Thanks anyway!
 

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