Redigera

Dela via


DirectoryContext Constructors

Definition

Initializes a new instance of the DirectoryContext class.

Overloads

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)

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)

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)

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

DirectoryContext(DirectoryContextType)

Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs

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

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

contextType is not valid.

This class does not work on the current platform.

See also

Applies to

DirectoryContext(DirectoryContextType, String)

Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs

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

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

name
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

name is not valid.

name is null.

contextType is not valid.

This class does not work on the current platform.

See also

Applies to

DirectoryContext(DirectoryContextType, String, String)

Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs

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);
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

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

The user name to use for access.

password
String

The password to use for access.

Exceptions

contextType is not valid.

This class does not work on the current platform.

See also

Applies to

DirectoryContext(DirectoryContextType, String, String, String)

Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs
Source:
DirectoryContext.cs

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);
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

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

name
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

The user name to use for access.

password
String

The password to use for access.

Exceptions

name is not valid.

name is null.

contextType is not valid.

This class does not work on the current platform.

See also

Applies to