User2.LoginName Property

Definition

Gets the user's full credentials.

public:
 property System::String ^ LoginName { System::String ^ get(); };
public string LoginName { get; }
member this.LoginName : string
Public ReadOnly Property LoginName As String

Property Value

The user's credentials as domain\username.

Examples

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

User2 thisUser = (User2)thisApplication.User;
thisXDocument.UI.Alert(thisUser.LoginName);
Dim thisUser As User2  = DirectCast(thisApplication.User, User2)
thisXDocument.UI.Alert(thisUser.LoginName)

Remarks

The LoginName property returns a user's credentials as domain\username. If the user's account does not belong to a domain, the property returns only username.

This is equivalent to calling System.Environment.UserDomainName+"\\"+System.Environment.UserName.

Because the LoginName property is newin Microsoft InfoPath, you must declare and cast to the User2 type to access it. For more information, see How to: Use Object Model Members That Are Not Compatible with InfoPath 2003.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

Applies to