DirectorySearcher.FindOne ()

The FindOne method executes the search and returns only the first entry found.

public SearchResult FindOne();
Public Function FindOne() As SearchResult

Parameters

This method has no parameters.

Return Values

A SearchResult that is the first entry found during the search.

Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code.

Remarks

If more than one entry is found during the search, only the first entry is returned. If no entries are found to match the search criteria, a null reference (Nothing in Visual Basic) is returned.

Requirements

Client Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98.
Server Requires Windows Server 2003, Windows 2000, or Windows NT 4.0.
Namespace

Defined in System.DirectoryServices.

Assembly

Requires System.DirectoryServices (in System.DirectoryServices.dll).

.NET Framework

Requires .NET Framework 1.0.

See Also

DirectorySearcher, DirectorySearcher Constructors, DirectorySearcher Methods, DirectorySearcher Properties, SearchResult, System.DirectoryServices Namespace, DirectorySearcher Members (Visual J# Syntax), Managed Extensions for C++ Programming