Platform SDK: Active Directory, ADSI, and Directory Services |
The IDirectorySearch::GetFirstRow method gets the first row of a search result. This method will issue or re-issue a new search, even if you have called this method before.
HRESULT GetFirstRow( ADS_SEARCH_HANDLE hSearchHandle );
This method returns the standard return values, as well as the following:
For other return values, see ADSI Error Codes.
When the ADS_SEARCHPREF_CACHE_RESULTS flag is not set (that is, FALSE), only forward scrolling is permitted, because the client might not cache all the query results. Calling IDirectorySearch::GetFirstRow more than once from the same row requires some back-scrolling and could result in erroneous outcomes for a paged or an asynchronous search initiated through OLE DB when the results are not guaranteed to remain in the cache.
hr = m_pSearch->ExecuteSearch(L"(objectCategory=contact)", pszAttr, dwCount, &hSearch ); if ( SUCCEEDED(hr) ) { hr = m_pSearch->GetFirstRow(hSearch); /* Get the data */ m_pSearch->CloseSearchHandle(hSearch); }
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.