DirectoryContext DirectoryContext DirectoryContext DirectoryContext Constructors

Definition

Overloads

DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType)

Initializes a new instance of the DirectoryContext class of the specified type that contains the credentials of the current user context.

DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified name and the credentials of the current user context.

DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified user name and password.

DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified target, user name, and password.

DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType) DirectoryContext(DirectoryContextType)

Initializes a new instance of the DirectoryContext class of the specified type that contains the credentials of the current user context.

public:
 DirectoryContext(System::DirectoryServices::ActiveDirectory::DirectoryContextType contextType);
public DirectoryContext (System.DirectoryServices.ActiveDirectory.DirectoryContextType contextType);
new System.DirectoryServices.ActiveDirectory.DirectoryContext : System.DirectoryServices.ActiveDirectory.DirectoryContextType -> System.DirectoryServices.ActiveDirectory.DirectoryContext
Public Sub New (contextType As DirectoryContextType)

Parameters

contextType
DirectoryContextType DirectoryContextType DirectoryContextType DirectoryContextType

One of the DirectoryContextType members that specifies the type of context to create. For this constructor, the context type must be Domain or Forest. Other types of directory contexts cannot be created using this constructor because other types require a constructor that includes a parameter specifying the directory or target name.

Exceptions

Security

DirectoryServicesPermission
Demand value: Demand

See also

DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String) DirectoryContext(DirectoryContextType, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified name and the credentials of the current user context.

public:
 DirectoryContext(System::DirectoryServices::ActiveDirectory::DirectoryContextType contextType, System::String ^ name);
public DirectoryContext (System.DirectoryServices.ActiveDirectory.DirectoryContextType contextType, string name);
new System.DirectoryServices.ActiveDirectory.DirectoryContext : System.DirectoryServices.ActiveDirectory.DirectoryContextType * string -> System.DirectoryServices.ActiveDirectory.DirectoryContext
Public Sub New (contextType As DirectoryContextType, name As String)

Parameters

contextType
DirectoryContextType DirectoryContextType DirectoryContextType DirectoryContextType

One of the DirectoryContextType members that specifies the type of context to create.

name
String String String String

The target of the directory context. This string can take any of the formats defined in the Remarks section of the DirectoryContext topic.

Exceptions

Security

DirectoryServicesPermission
Demand value: Demand

See also

DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String) DirectoryContext(DirectoryContextType, String, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified user name and password.

public:
 DirectoryContext(System::DirectoryServices::ActiveDirectory::DirectoryContextType contextType, System::String ^ username, System::String ^ password);
public DirectoryContext (System.DirectoryServices.ActiveDirectory.DirectoryContextType contextType, string username, string password);
new System.DirectoryServices.ActiveDirectory.DirectoryContext : System.DirectoryServices.ActiveDirectory.DirectoryContextType * string * string -> System.DirectoryServices.ActiveDirectory.DirectoryContext
Public Sub New (contextType As DirectoryContextType, username As String, password As String)

Parameters

contextType
DirectoryContextType DirectoryContextType DirectoryContextType DirectoryContextType

One of the DirectoryContextType members that specifies the type of context to create. For this constructor, this parameter must be DirectoryContextType or DirectoryContextType.

username
String String String String

The user name to use for access.

password
String String String String

The password to use for access.

Exceptions

Security

DirectoryServicesPermission
Demand value: Demand

See also

DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String) DirectoryContext(DirectoryContextType, String, String, String)

Initializes a new instance of the DirectoryContext class of the specified type that contains the specified target, user name, and password.

public:
 DirectoryContext(System::DirectoryServices::ActiveDirectory::DirectoryContextType contextType, System::String ^ name, System::String ^ username, System::String ^ password);
public DirectoryContext (System.DirectoryServices.ActiveDirectory.DirectoryContextType contextType, string name, string username, string password);
new System.DirectoryServices.ActiveDirectory.DirectoryContext : System.DirectoryServices.ActiveDirectory.DirectoryContextType * string * string * string -> System.DirectoryServices.ActiveDirectory.DirectoryContext
Public Sub New (contextType As DirectoryContextType, name As String, username As String, password As String)

Parameters

contextType
DirectoryContextType DirectoryContextType DirectoryContextType DirectoryContextType

One of the DirectoryContextType members that specifies the type of context to create.

name
String String String String

The target of the directory context. This string can take any of the formats defined in the Remarks section of the DirectoryContext topic.

username
String String String String

The user name to use for access.

password
String String String String

The password to use for access.

Exceptions

Security

DirectoryServicesPermission
Demand value: Demand

See also

Applies to