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

To DirectoryEntry odpovídá hodnotě SearchResult.

Příklady

Následující příklad je výňatek z příkladu v SearchResult. Původní příklad vytvoří nový DirectoryEntry objekt s požadovanou cestou a použije metodu FindOne k zahájení hledání. Po provedení hledání použije příklad metodu GetDirectoryEntry k načtení položky živého adresáře, 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);

Poznámky

Použijte GetDirectoryEntry , pokud chcete zobrazit živou položku místo položky, která byla vrácena , DirectorySearchernebo když chcete vyvolat metodu u vráceného objektu.

Note

Volání GetDirectoryEntry jednotlivých SearchResult vrácených volání DirectorySearcher může být pomalé.

Platí pro