DirectoryEntry 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 DirectoryEntry 类的新实例。
重载
DirectoryEntry() |
初始化 DirectoryEntry 类的新实例。 |
DirectoryEntry(Object) |
初始化 DirectoryEntry 类的新实例,该类可绑定到指定的本机 Active Directory 域服务对象。 |
DirectoryEntry(String) |
初始化 DirectoryEntry 类的新实例,该类将此实例绑定到位于指定路径的 Active Directory 域服务中的节点。 |
DirectoryEntry(String, String, String) |
初始化 DirectoryEntry 类的新实例。 |
DirectoryEntry(String, String, String, AuthenticationTypes) |
初始化 DirectoryEntry 类的新实例。 |
DirectoryEntry()
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
初始化 DirectoryEntry 类的新实例。
public:
DirectoryEntry();
public DirectoryEntry ();
Public Sub New ()
适用于
DirectoryEntry(Object)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
初始化 DirectoryEntry 类的新实例,该类可绑定到指定的本机 Active Directory 域服务对象。
public:
DirectoryEntry(System::Object ^ adsObject);
public DirectoryEntry (object adsObject);
new System.DirectoryServices.DirectoryEntry : obj -> System.DirectoryServices.DirectoryEntry
Public Sub New (adsObject As Object)
参数
- adsObject
- Object
要绑定到的本机 Active Directory 域服务对象的名称。
注解
此构造函数使程序能够在通过本机 API 实现 IAD 接口的DirectoryEntry本机 Active Directory 域服务 对象上使用 类的方法和属性。 有关 IAD 接口的详细信息,请参阅 IAD 一 文。
适用于
DirectoryEntry(String)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
初始化 DirectoryEntry 类的新实例,该类将此实例绑定到位于指定路径的 Active Directory 域服务中的节点。
public:
DirectoryEntry(System::String ^ path);
public DirectoryEntry (string path);
public DirectoryEntry (string? path);
new System.DirectoryServices.DirectoryEntry : string -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String)
参数
- path
- String
一个路径,在此处将 DirectoryEntry(String) 绑定到目录。 Path 属性初始化为该值。
示例
以下示例将 DirectoryEntry 对象绑定到指定路径处的目录项,并显示 Path 节点的 属性指定的每个子项的 Children 属性。
Public Class PrintChildren
'Entry point which delegates to C-style main Private Function.
Public Overloads Shared Sub Main()
Main(System.Environment.GetCommandLineArgs())
End Sub
Overloads Public Shared Sub Main(args() As String)
Dim objDE As DirectoryEntry
Dim strPath As String = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com"
If args.Length > 0 Then
strPath = args(1)
End If
' Create a new DirectoryEntry with the given path.
objDE = New DirectoryEntry(strPath)
Dim objChildDE As DirectoryEntry
For Each objChildDE In objDE.Children
Console.WriteLine(objChildDE.Path)
Next objChildDE
End Sub 'Main
End Class 'PrintChildren
public class PrintChildren{
public static void Main(String[] args)
{
DirectoryEntry objDE;
String strPath="LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args.Length>0)strPath=args[1];
// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);
foreach(DirectoryEntry objChildDE in objDE.Children)
Console.WriteLine(objChildDE.Path);
}
}
int main()
{
String^ args[] = Environment::GetCommandLineArgs();
DirectoryEntry^ objDE;
String^ strPath = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args->Length>1)
{
strPath=args[1];
}
// Create a new DirectoryEntry with the given path.
objDE = gcnew DirectoryEntry(strPath);
System::Collections::IEnumerator^ enum0 = objDE->Children->GetEnumerator();
while (enum0->MoveNext())
{
DirectoryEntry^ objChildDE = safe_cast<DirectoryEntry^>(enum0->Current);
Console::WriteLine(objChildDE->Path);
}
}
适用于
DirectoryEntry(String, String, String)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
初始化 DirectoryEntry 类的新实例。
public:
DirectoryEntry(System::String ^ path, System::String ^ username, System::String ^ password);
public DirectoryEntry (string path, string username, string password);
public DirectoryEntry (string? path, string? username, string? password);
new System.DirectoryServices.DirectoryEntry : string * string * string -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String, username As String, password As String)
参数
- path
- String
此 DirectoryEntry 的路径。 Path 属性初始化为该值。
适用于
DirectoryEntry(String, String, String, AuthenticationTypes)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
初始化 DirectoryEntry 类的新实例。
public:
DirectoryEntry(System::String ^ path, System::String ^ username, System::String ^ password, System::DirectoryServices::AuthenticationTypes authenticationType);
public DirectoryEntry (string path, string username, string password, System.DirectoryServices.AuthenticationTypes authenticationType);
public DirectoryEntry (string? path, string? username, string? password, System.DirectoryServices.AuthenticationTypes authenticationType);
new System.DirectoryServices.DirectoryEntry : string * string * string * System.DirectoryServices.AuthenticationTypes -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String, username As String, password As String, authenticationType As AuthenticationTypes)
参数
- path
- String
此 DirectoryEntry 的路径。 Path 属性初始化为该值。
- authenticationType
- AuthenticationTypes
AuthenticationTypes 值之一。 AuthenticationType 属性初始化为该值。