Share via


User2.UserName property

Gets only the user's username.

Namespace:  Microsoft.Office.Interop.InfoPath
Assembly:  Microsoft.Office.Interop.InfoPath (in Microsoft.Office.Interop.InfoPath.dll)

Syntax

'Declaration
ReadOnly Property UserName As String
    Get
'Usage
Dim instance As User2
Dim value As String

value = instance.UserName
string UserName { get; }

Property value

Type: System.String
The user's username.

Remarks

Calling the UserName property is equivalent to calling System.Environment.UserName.

Examples

In the following example, the UserName property is used to display the current user's login credentials.

User2 thisUser = thisApplication.User;
thisXDocument.UI.Alert(thisUser.UserName);
Dim thisUser As User2  = thisApplication.User
thisXDocument.UI.Alert(thisUser.UserName)

See also

Reference

User2 interface

User2 members

Microsoft.Office.Interop.InfoPath namespace