DirectoryEntry DirectoryEntry DirectoryEntry DirectoryEntry Constructors

定義

多載

DirectoryEntry() DirectoryEntry() DirectoryEntry()

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object)

初始化 DirectoryEntry 類別的新執行個體,這個執行個體繫結至指定的原生 Active Directory 網域服務物件。Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String)

初始化 DirectoryEntry 類別的新執行個體,這個執行個體繫結至位在指定路徑之 Active Directory 網域服務中的節點。Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory Domain Services located at the specified path.

DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String)

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes)

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

DirectoryEntry() DirectoryEntry() DirectoryEntry()

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

public:
 DirectoryEntry();
public DirectoryEntry ();
Public Sub New ()

安全性

DirectoryServicesPermission
Demand

DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object) DirectoryEntry(Object)

初始化 DirectoryEntry 類別的新執行個體,這個執行個體繫結至指定的原生 Active Directory 網域服務物件。Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

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 Object Object Object

要繫結至之原生 Active Directory 網域服務物件的名稱。The name of the native Active Directory Domain Services object to bind to.

備註

此函式可讓程式在原生 Active Directory Domain Services 物件上使用DirectoryEntry類別的方法和屬性,透過原生 API 來執行 iad 介面。This constructor enables a program to use the methods and properties of the DirectoryEntry class on a native Active Directory Domain Services object that implements the IADs interface through a native API. 如需有關 Iad 介面的詳細資訊,請參閱iad一文。For more information about the IADs interface, see the IADs article.

安全性

DirectoryServicesPermission
Demand

DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String) DirectoryEntry(String)

初始化 DirectoryEntry 類別的新執行個體,這個執行個體繫結至位在指定路徑之 Active Directory 網域服務中的節點。Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory Domain Services located at the specified path.

public:
 DirectoryEntry(System::String ^ path);
public DirectoryEntry (string path);
new System.DirectoryServices.DirectoryEntry : string -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String)

參數

path
String String String String

路徑,要將 DirectoryEntry(String) 繫結至目錄的位置。The path at which to bind the DirectoryEntry(String) to the directory. Path 屬性 (Property) 會初始化為這個值。The Path property is initialized to this value.

範例

下列範例DirectoryEntry會將物件系結至指定路徑的目錄專案,並Path顯示節點的Children屬性所指定之每個子專案的屬性。The following example binds a DirectoryEntry object to the directory entry at the specified path, and displays the Path property of each child entry that is specified by the node's Children property.

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

安全性

DirectoryServicesPermission
Demand

DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String) DirectoryEntry(String, String, String)

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

public:
 DirectoryEntry(System::String ^ path, System::String ^ username, System::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 String String String

這個 DirectoryEntry 的路徑。The path of this DirectoryEntry. Path 屬性 (Property) 會初始化為這個值。The Path property is initialized to this value.

username
String String String String

驗證用戶端時所要使用的使用者名稱。The user name to use when authenticating the client. Username 屬性 (Property) 會初始化為這個值。The Username property is initialized to this value.

password
String String String String

驗證用戶端時所要使用的密碼。The password to use when authenticating the client. Password 屬性 (Property) 會初始化為這個值。The Password property is initialized to this value.

安全性

DirectoryServicesPermission
Demand

DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes) DirectoryEntry(String, String, String, AuthenticationTypes)

初始化 DirectoryEntry 類別的新執行個體。Initializes a new instance of the DirectoryEntry class.

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

這個 DirectoryEntry 的路徑。The path of this DirectoryEntry. Path 屬性 (Property) 會初始化為這個值。The Path property is initialized to this value.

username
String String String String

驗證用戶端時所要使用的使用者名稱。The user name to use when authenticating the client. Username 屬性 (Property) 會初始化為這個值。The Username property is initialized to this value.

password
String String String String

驗證用戶端時所要使用的密碼。The password to use when authenticating the client. Password 屬性 (Property) 會初始化為這個值。The Password property is initialized to this value.

authenticationType
AuthenticationTypes AuthenticationTypes AuthenticationTypes AuthenticationTypes

其中一個 AuthenticationTypes 值。One of the AuthenticationTypes values. AuthenticationType 屬性 (Property) 會初始化為這個值。The AuthenticationType property is initialized to this value.

安全性

DirectoryServicesPermission
Demand

另請參閱

適用於