SearchResult.GetDirectoryEntry メソッド
アセンブリ: System.DirectoryServices (system.directoryservices.dll 内)

Dim instance As SearchResult Dim returnValue As DirectoryEntry returnValue = instance.GetDirectoryEntry
SearchResult に対応する DirectoryEntry。

DirectorySearcher を通じて返されるエントリではなく、ライブ エントリを参照する場合や、返されたオブジェクトでメソッドを呼び出す場合は、GetDirectoryEntry を使用します。
![]() |
---|
DirectorySearcher で返された SearchResult ごとに GetDirectoryEntry を呼び出すと、時間がかかることがあります。 |

次の例は、SearchResult の例の抜粋です。元の例は、目的のパスを持つ新しい DirectoryEntry オブジェクトを作成し、FindOne メソッドを使用して検索を実行します。この例では、検索を実行した後、GetDirectoryEntry メソッドを使用して、検索結果に示されるライブ ディレクトリ エントリを取得します。
' 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);

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SearchResult.GetDirectoryEntry メソッドのページへのリンク