Export (0) Print
Expand All

ComputerPrincipal.FindByIdentity Method (PrincipalContext, IdentityType, String)

Returns a computer 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 ComputerPrincipal FindByIdentity(
	PrincipalContext context,
	IdentityType identityType,
	string identityValue
)

Parameters

context
Type: System.DirectoryServices.AccountManagement.PrincipalContext

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

identityType
Type: System.DirectoryServices.AccountManagement.IdentityType

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

identityValue
Type: System.String

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

Return Value

Type: System.DirectoryServices.AccountManagement.ComputerPrincipal
A ComputerPrincipal object that matches the specified identity value and type, or null if no matches are found.

ExceptionCondition
MultipleMatchesException

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

InvalidEnumerationOperatorException

The identity value is not a valid IdentityType enumeration value.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft