SearchResult.GetDirectoryEntry Metod

Definition

Hämtar DirectoryEntry som motsvarar SearchResult från Doménové služby Active Directory-hierarkin.

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

Returer

Det DirectoryEntry som motsvarar SearchResult.

Exempel

Följande exempel är ett utdrag av exemplet i SearchResult. Det ursprungliga exemplet skapar ett nytt DirectoryEntry objekt med önskad sökväg och använder FindOne metoden för att initiera sökningen. När sökningen har utförts använder GetDirectoryEntry exemplet metoden för att hämta den livekatalogpost som identifieras i sökresultaten.

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

Kommentarer

Använd GetDirectoryEntry när du vill titta på liveposten i stället för posten som returnerades via DirectorySearcher, eller när du vill anropa en metod för objektet som returnerades.

Note

Det kan ta lång tid att anropa GetDirectoryEntry var och en SearchResult som DirectorySearcher returneras.

Gäller för