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:

For more information and other return values, see ADSI Error Codes.

Return Code Description
S_OK The search preference was set.
E_ADS_BAD_PARAMETER The caller supplied an invalid array of ADS_SEARCHPREF_INFO structures.

Example Code [C++]

The following C++ code example shows 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

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IDirectorySearch, ADS_SEARCHPREF_INFO, ADSI Error Codes