PrincipalContext.UserName Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the value specified in the username parameter in the constructor.

Namespace:   System.DirectoryServices.AccountManagement
Assembly:  System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)

public string UserName { get; }

Property Value

Type: System.String

The username used to connect to the store, or null if no user name exists.

This property can be set by passing it a user name in any one of various different formats. For a complete list of the acceptable types of formats, see the ADS_NAME_TYPE_ENUM documentation here.

.NET Framework
Available since 3.5

PrincipalContext Class
System.DirectoryServices.AccountManagement Namespace Overview

Return to top