Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ADS_STATUSENUM

ADS_STATUSENUM enumeration

The ADS_STATUSENUM enumeration specifies the status of a search preference set with the IDirectorySearch::SetSearchPreference method.

Syntax


typedef enum  { 
  ADS_STATUS_S_OK                     = 0,
  ADS_STATUS_INVALID_SEARCHPREF       = 1,
  ADS_STATUS_INVALID_SEARCHPREFVALUE  = 2
} ADS_STATUSENUM;

Constants

ADS_STATUS_S_OK

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.

Note  Because VBScript cannot read data from a type library, VBScript applications do not recognize the symbolic constants as defined above. You should use the numeric constants instead to set the appropriate flags in your VBScript applications. To use the symbolic constants as a good programming practice, write explicit declarations of such constants, as done in the following code example.

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

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Header

Iads.h

See also

ADS_SEARCHPREF_ENUM
ADS_SEARCHPREF_INFO
IDirectorySearch::SetSearchPreference
ADSI Enumerations

 

 

Show:
© 2015 Microsoft