SearchResult.GetDirectoryEntry Metoda

Definice

Načte DirectoryEntry , který odpovídá SearchResult z hierarchie 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

Návraty

DirectoryEntry

DirectoryEntry, Který odpovídá SearchResult .

Příklady

V následujícím příkladu je výpis příkladu v SearchResult . Původní příklad vytvoří nový DirectoryEntry objekt s požadovanou cestou a použije FindOne metodu k zahájení hledání. Po provedení hledání použije příklad GetDirectoryEntry metodu k načtení položky v adresáři Live, která je identifikována ve výsledcích hledání.

' 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);  
// Get the 'DirectoryEntry' that corresponds to 'mySearchResult'.  
DirectoryEntry^ myDirectoryEntry = mySearchResult->GetDirectoryEntry();  
Console::WriteLine(  
    String::Concat("\nThe name of the 'myDirectoryEntry' ",  
    "directory entry that corresponds to the ",  
    "'mySearchResult' search result is : {0}\n"),  
    myDirectoryEntry->Name);  

Poznámky

Použijte GetDirectoryEntry v případě, že se chcete podívat na aktivní položku namísto položky, která byla vrácena prostřednictvím DirectorySearcher , nebo když chcete vyvolat metodu u objektu, který byl vrácen.

Poznámka

Volání GetDirectoryEntry na každou SearchResult vrácenou prostřednictvím DirectorySearcher může být pomalé.

Platí pro