DirectoryEntry Constructors

Definition

Inicia uma nova instância da classe DirectoryEntry.Initializes a new instance of the DirectoryEntry class.

Overloads

DirectoryEntry()

Inicia uma nova instância da classe DirectoryEntry.Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(Object)

Inicializa uma nova instância da classe DirectoryEntry que é associada ao objeto especificado nativo do Active Directory Domain Services.Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.

DirectoryEntry(String)

Inicializa uma nova instância da classe DirectoryEntry que associa essa instância ao nó no Active Directory Domain Services localizado no caminho especificado.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)

Inicia uma nova instância da classe DirectoryEntry.Initializes a new instance of the DirectoryEntry class.

DirectoryEntry(String, String, String, AuthenticationTypes)

Inicia uma nova instância da classe DirectoryEntry.Initializes a new instance of the DirectoryEntry class.

DirectoryEntry()

Inicia uma nova instância da classe DirectoryEntry.Initializes a new instance of the DirectoryEntry class.

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

DirectoryEntry(Object)

Inicializa uma nova instância da classe DirectoryEntry que é associada ao objeto especificado nativo do Active Directory Domain Services.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)

Parameters

adsObject
Object

O nome do objeto do Active Directory Domain Services nativos de associação.The name of the native Active Directory Domain Services object to bind to.

Remarks

Esse construtor permite que um programa use os métodos e as propriedades da classe DirectoryEntry em um objeto Active Directory Domain Services nativo que implementa a interface IADs por meio de uma API nativa.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. Para obter mais informações sobre a interface IADs, consulte o artigo IADs .For more information about the IADs interface, see the IADs article.

DirectoryEntry(String)

Inicializa uma nova instância da classe DirectoryEntry que associa essa instância ao nó no Active Directory Domain Services localizado no caminho especificado.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)

Parameters

path
String

O caminho no qual o DirectoryEntry(String) será associado ao diretório.The path at which to bind the DirectoryEntry(String) to the directory. A propriedade Path é inicializada com esse valor.The Path property is initialized to this value.

Examples

O exemplo a seguir associa um objeto DirectoryEntry à entrada de diretório no caminho especificado e exibe a propriedade Path de cada entrada filho que é especificada pela propriedade de Children do nó.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);  
    }  
}  

DirectoryEntry(String, String, String)

Inicia uma nova instância da classe 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)

Parameters

path
String

O caminho deste DirectoryEntry.The path of this DirectoryEntry. A propriedade Path é inicializada com esse valor.The Path property is initialized to this value.

username
String

O nome de usuário a ser usado ao autenticar o cliente.The user name to use when authenticating the client. A propriedade Username é inicializada com esse valor.The Username property is initialized to this value.

password
String

A senha a ser usada na autenticação do cliente.The password to use when authenticating the client. A propriedade Password é inicializada com esse valor.The Password property is initialized to this value.

DirectoryEntry(String, String, String, AuthenticationTypes)

Inicia uma nova instância da classe 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)

Parameters

path
String

O caminho deste DirectoryEntry.The path of this DirectoryEntry. A propriedade Path é inicializada com esse valor.The Path property is initialized to this value.

username
String

O nome de usuário a ser usado ao autenticar o cliente.The user name to use when authenticating the client. A propriedade Username é inicializada com esse valor.The Username property is initialized to this value.

password
String

A senha a ser usada na autenticação do cliente.The password to use when authenticating the client. A propriedade Password é inicializada com esse valor.The Password property is initialized to this value.

authenticationType
AuthenticationTypes

Um dos valores de AuthenticationTypes.One of the AuthenticationTypes values. A propriedade AuthenticationType é inicializada com esse valor.The AuthenticationType property is initialized to this value.

See also

Applies to