Platform SDK: Active Directory, ADSI, and Directory Services

IDirectorySearch::SetSearchPreference

The IDirectorySearch::SetSearchPreference method specifies a search preference for obtaining data in a subsequent search.

HRESULT SetSearchPreference(
  PADS_SEARCHPREF_INFO pSearchPrefs,
  DWORD dwNumPrefs 
);

Parameters

pSearchPrefs
[in] Provides a caller-allocated array of ADS_SEARCHPREF_INFO structures that contain the search preferences to be set.
dwNumPrefs
[in] Provides the size of the pSearchPrefs array.

Return Values

This method supports the standard return values, as well as the following:

S_OK
The search preference was set.
E_ADS_BAD_PARAMETER
The caller has supplied an invalid array of the ADS_SEARCHPREF_INFO structures.

For other return values, see ADSI Error Codes.

Example Code [C++]

The following C++ code snippet illustrates how to set the page size preference:

ADS_SEARCHPREF_INFO prefInfo[1];
prefInfo[0].dwSearchPref = ADS_SEARCHPREF_PAGESIZE;
prefInfo[0].vValue.dwType = ADSTYPE_INTEGER;
prefInfo[0].vValue.Integer = 100;
hr = m_pSearch->SetSearchPreference( prefInfo, 1);

Requirements

  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.

See Also

IDirectorySearch, ADS_SEARCHPREF_INFO, ADSI Error Codes