Principal.FindByIdentity Method (PrincipalContext, IdentityType, String)


Returns a principal object that matches the specified identity type, and value. This version of the FindByIdentity method determines the format of the identity value.

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

public static Principal FindByIdentity(
	PrincipalContext context,
	IdentityType identityType,
	string identityValue


Type: System.DirectoryServices.AccountManagement.PrincipalContext

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

Type: System.DirectoryServices.AccountManagement.IdentityType

An IdentityType enumeration value that specifies the format of the identityValue parameter.

Type: System.String

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

Return Value

Type: System.DirectoryServices.AccountManagement.Principal

A Principal object that matches the specified identity value and type or null if no matches are found.

Exception Condition

Multiple principal objects matching the current object were found.


The identity type is not a valid IdentityType enumeration value.

.NET Framework
Available since 3.5
Return to top