Platform SDK: Active Directory, ADSI, and Directory Services |
When you perform a search using IDirectorySearch, the IDirectorySearch::ExecuteSearch method does not send the search request to the server — this method only saves the search parameters. The search request is sent when you call IDirectorySearch::GetFirstRow or IDirectorySearch::GetNextRow.
For Active Directory searches, the primary difference between synchronous and asynchronous is when the first row of the result is returned (that is, when the first GetFirstRow or GetNextRow call returns):
If paging is enabled, the first row is returned when the first page of the result set is returned.
If paging is enabled, the first row is returned when the first page of the result set is returned.
To specify the asynchronous option, include a ADS_SEARCHPREF_INFO structure with ADS_SEARCHPREF_ASYNCHRONOUS set to TRUE in the array passed in the IDirectorySearch::SetSearchPreference call.
If the ADS_SEARCHPREF_ASYNCHRONOUS search preference is not set, the default is synchronous.