Share via


User2.UserName Property

InfoPath Developer Reference

Gets the user's username. Read-only

Version Information
 Version Added:  InfoPath 2007

Syntax

expression.UserName

expression   An expression that returns a User2 object.

Return Value
String

Remarks

Calling the UserName property is equivalent to calling System.Environment.UserName in .NET code. A new function in Microsoft Office InfoPath 2007 allows the username to be inserted declaratively using the Insert Function dialog box. Select All from the categories list, then select userName.

Bb230010.vs_note(en-us,office.12).gif  Note
The Local Intranet zone permissions allow reading the username from the environment, so this method can be called by domain-based form templates.

Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Example

In the following example, a variable stores the UserName.

JScript
  varUserName = Application.User.UserName;

See Also