SearchResult.GetDirectoryEntry Método

Definição

Recupera o DirectoryEntry que corresponde ao SearchResult da hierarquia Active Directory Domain Services.

public:
 System::DirectoryServices::DirectoryEntry ^ GetDirectoryEntry();
public System.DirectoryServices.DirectoryEntry GetDirectoryEntry();
member this.GetDirectoryEntry : unit -> System.DirectoryServices.DirectoryEntry
Public Function GetDirectoryEntry () As DirectoryEntry

Devoluções

O DirectoryEntry que corresponde ao SearchResult.

Exemplos

O exemplo seguinte é um excerto do exemplo em SearchResult. O exemplo original cria um novo DirectoryEntry objeto com o caminho desejado e usa o FindOne método para iniciar a pesquisa. Após a pesquisa, o exemplo utiliza o GetDirectoryEntry método para recuperar a entrada do diretório em tempo real identificada nos resultados da pesquisa.

' Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
Dim myDirectoryEntry As DirectoryEntry = mySearchResult.GetDirectoryEntry()
Console.WriteLine(ControlChars.Newline + "The name of the 'myDirectoryEntry' " + _
            "directory entry that corresponds to the " + _
            "'mySearchResult' search result is : {0}" + _
            ControlChars.Newline, myDirectoryEntry.Name)
// Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.
DirectoryEntry myDirectoryEntry =
                           mySearchResult.GetDirectoryEntry();
Console.WriteLine("\nThe name of the 'myDirectoryEntry' " +
                  "directory entry that corresponds to the " +
                  "'mySearchResult' search result is : {0}\n",
                  myDirectoryEntry.Name);

Observações

Use GetDirectoryEntry quando quiser olhar para a entrada em tempo real em vez da entrada que foi devolvida através DirectorySearcherde , ou quando quiser invocar um método no objeto que foi devolvido.

Note

Ligar GetDirectoryEntry a cada SearchResult passagem DirectorySearcher devolvida pode ser lento.

Aplica-se a