UserPrincipal.FindByIdentity Method (PrincipalContext, String)


Returns a user principal object that matches the specified identity value.

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

public static UserPrincipal FindByIdentity(
	PrincipalContext context,
	string identityValue


Type: System.DirectoryServices.AccountManagement.PrincipalContext

The PrincipalContext that specifies the server or domain against which operations are performed.

Type: System.String

The identity of the user principal. This parameter can be any format that is contained in the IdentityType enumeration.

Return Value

Type: System.DirectoryServices.AccountManagement.UserPrincipal

A UserPrincipal object that matches the specified identity value, or null if no matches are found.

Exception Condition

Multiple user principal objects matching the current user object were found.

.NET Framework
Available since 3.5
Return to top