DirectoryContext 构造函数

定义

初始化 DirectoryContext 类的新实例。

重载

DirectoryContext(DirectoryContextType)

初始化指定类型的 DirectoryContext 类的新实例,它包含当前用户上下文的凭据。

DirectoryContext(DirectoryContextType, String)

初始化指定类型的 DirectoryContext 类的新实例,它包含当前用户上下文的指定名称和凭据。

DirectoryContext(DirectoryContextType, String, String)

初始化指定类型的 DirectoryContext 类的新实例,它包含指定的用户名和密码。

DirectoryContext(DirectoryContextType, String, String, String)

初始化指定类型的 DirectoryContext 类的新实例,它包含指定目标、用户名和密码。

DirectoryContext(DirectoryContextType)

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

初始化指定类型的 DirectoryContext 类的新实例,它包含当前用户上下文的凭据。

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)

参数

contextType
DirectoryContextType

DirectoryContextType 成员之一,它指定要创建的上下文的类型。 对于此构造函数,上下文类型必须为 DomainForest。 其他类型的目录上下文不能使用此构造函数创建,因为其他类型需要构造函数包括用于指定目录或目标名称的参数。

例外

contextType 无效。

在当前平台上,此类不起作用。

另请参阅

适用于

DirectoryContext(DirectoryContextType, String)

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

初始化指定类型的 DirectoryContext 类的新实例,它包含当前用户上下文的指定名称和凭据。

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)

参数

contextType
DirectoryContextType

DirectoryContextType 成员之一,它指定要创建的上下文的类型。

name
String

目录上下文的目标。 此字符串可以采用在 DirectoryContext 主题的“备注”部分中定义的任何格式。

例外

name 无效。

namenull

contextType 无效。

在当前平台上,此类不起作用。

另请参阅

适用于

DirectoryContext(DirectoryContextType, String, String)

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

初始化指定类型的 DirectoryContext 类的新实例,它包含指定的用户名和密码。

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)

参数

contextType
DirectoryContextType

DirectoryContextType 成员之一,它指定要创建的上下文的类型。 对于该构造函数,此参数必须是 DirectoryContextTypeDirectoryContextType

username
String

要用于访问的用户名。

password
String

用于访问的密码。

例外

contextType 无效。

在当前平台上,此类不起作用。

另请参阅

适用于

DirectoryContext(DirectoryContextType, String, String, String)

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

初始化指定类型的 DirectoryContext 类的新实例,它包含指定目标、用户名和密码。

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)

参数

contextType
DirectoryContextType

DirectoryContextType 成员之一,它指定要创建的上下文的类型。

name
String

目录上下文的目标。 此字符串可以采用在 DirectoryContext 主题的“备注”部分中定义的任何格式。

username
String

要用于访问的用户名。

password
String

用于访问的密码。

例外

name 无效。

namenull

contextType 无效。

在当前平台上,此类不起作用。

另请参阅

适用于