InfoPath & System.Environment.UserName

S

Sushi

In my InfoPath form I am autofilling a textbox with
System.Environment.UserName as in the MSDN Infopath Training. I then use
this field as the login information for a query to a web service. I am
having trouble with the form retrieving the UserName after I publish it for
users to access via a web page link to the form. Anyone have any suggestions?
 
A

Alessandro Catorcini [MSFT]

Where is the server where you published the form?
If it is on an intranet, it should work, but if it is on the Internet, the
behavior is by design: the form template gets the same permissions that a
web page on the same location would have, and you don't want a web page to
read the username of the logged-in user.

Hope this helps

--Alessandro

This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

Sushi

The form is published on an intranet, so I don't believe that is the issue.
Would you know if this has anything to do with how I enable full trust?
 
H

hobbyman

I was wondering if you ever figured out the answer. I am having the
very same problem and have been working on it for a few days.

--lance
 
S

Sushi

I believe it had to do with the order of my code. Here is what I now have, I
hope it helps:

Dim emp As New WebService.Class
Dim ds As DataSet = emp.WebMethod(System.Environment.UserName)

Dim nodeEmpName As IXMLDOMNode =
thisXDocument.DOM.selectSingleNode("my:myFields/my:txtEmpName")

If nodeEmpName.text = "" Then
nodeEmpName.text = ds.Tables("Employee").Rows(0).Item("DisplayName")
End If
 
M

Marion

Could you share you code you use to autofill the textbox with
System.Environment.UserName. I need to do that and I haven't been able to
find an example of doing this.

Thanks
 

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