ADS_STATUSENUM enumeration (iads.h)
The ADS_STATUSENUM enumeration specifies the status of a search preference set with the IDirectorySearch::SetSearchPreference method.
Syntax
typedef enum __MIDL___MIDL_itf_ads_0000_0000_0019 {
ADS_STATUS_S_OK = 0,
ADS_STATUS_INVALID_SEARCHPREF,
ADS_STATUS_INVALID_SEARCHPREFVALUE
} ADS_STATUSENUM;
Constants
ADS_STATUS_S_OK Value: 0 The search preference was set successfully. |
ADS_STATUS_INVALID_SEARCHPREF The search preference specified in the dwSearchPref member of the ADS_SEARCHPREF_INFO structure is invalid. Search preferences must be taken from the ADS_SEARCHPREF_ENUM enumeration. |
ADS_STATUS_INVALID_SEARCHPREFVALUE The value specified in the vValue member of the ADS_SEARCHPREF_INFO structure is invalid for the corresponding search preference. |
Remarks
The IDirectorySearch::SetSearchPreference method sets the dwStatus member ADS_SEARCHPREF_INFO structure to one of the ADS_STATUSENUM values to indicate the status of the corresponding search preference. Callers can use this status value to decide whether to execute a search.
The ADS_STATUS_INVALID_SEARCHPREF status value may be set if you set a valid search preference, but that preference is not supported. For example, if you set ADS_SEARCHPREF_SORT_ON, but the server you communicate with does not support the LDAP server-side sort control, the dwStatus member of the ADS_SEARCHPREF_INFO structure is set to ADS_STATUS_INVALID_SEARCHPREF by the IDirectorySearch::SetSearchPreference call.
Examples
The following code example shows how to use the ADS_STATUSENUM enumeration with the IDirectorySearch::SetSearchPreference method to determine the status of a search preference.
/***************************************************************************
SetAndCheckSearchTimeout()
***************************************************************************/
HRESULT SetAndCheckSearchTimeout(IDirectorySearch *pSearch,
DWORD dwTimeout,
ADS_STATUSENUM *pStatus)
{
if(!pSearch || !pStatus)
{
return E_INVALIDARG;
}
HRESULT hr;
ADS_SEARCHPREF_INFO SearchPref;
SearchPref.dwSearchPref = ADS_SEARCHPREF_TIMEOUT;
SearchPref.vValue.dwType = ADSTYPE_INTEGER;
SearchPref.vValue.Integer = dwTimeout;
SearchPref.dwStatus = ADS_STATUS_S_OK;
hr = pSearch->SetSearchPreference(&SearchPref, 1);
if(S_OK != hr)
{
return hr;
}
*pStatus = SearchPref.dwStatus;
return S_OK;
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista |
Minimum supported server | Windows Server 2008 |
Header | iads.h |