Domain.GetDomain Method (DirectoryContext)

 

Gets the Domain object for the specified context.

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

public static Domain GetDomain(
	DirectoryContext context
)

Parameters

context
Type: System.DirectoryServices.ActiveDirectory.DirectoryContext

An DirectoryContext object that contains the target and credentials to use to retrieve the object. The type of the context must be a domain or directory server.

Return Value

Type: System.DirectoryServices.ActiveDirectory.Domain

An Domain object that represents the domain for the specified context.

Exception Condition
ActiveDirectoryObjectNotFoundException

A connection to the target specified in context could not be made.

ArgumentException

context is not valid.

ArgumentNullException

context is null.

.NET Framework
Available since 2.0
Return to top
Show: