Platform SDK: Active Directory, ADSI, and Directory Services

ADS_SCOPEENUM

The ADS_SCOPEENUM enumeration specifies the scope of a directory search.

typedef enum {
  ADS_SCOPE_BASE        = 0,
  ADS_SCOPE_ONELEVEL    = 1,
  ADS_SCOPE_SUBTREE     = 2
  } ADS_SCOPEENUM;

Elements

ADS_SCOPE_BASE
Limits the search to the base object. The result contains at most one object.
ADS_SCOPE_ONELEVEL
Searches one level of the immediate children, excluding the base object.
ADS_SCOPE_SUBTREE
Searches the whole subtree, including all the children and the base object itself.

Remarks

If you do not explicitly set the search scope, the default is ADS_SCOPE_SUBTREE.

Note  Because VBScript cannot read information from a type library, VBScript applications do not understand the symbolic constants as defined above. You should use the numerical constants instead to set the appropriate flags in your VBScript applications. If you want to use the symbolic constants as a good programming practice, you should make explicit declarations of such constants, as done here, in your VBScript applications.

Example Code [C++]

Search scope is one of the search preferences clients can specify. The following code snippet illustrates how to accomplish this using the ADS_SEARCHPREF_INFO structure, together with the elements defined in the ADS_SEARCHPREF_ENUM and this enumeration.

ADS_SEARCHPREF_INFO prefInfo;
prefInfo.dwSearchPref = ADS_SEARCHPREF_SEARCH_SCOPE;
prefInfo.vValue.dwType = ADSTYPE_INTEGER;
prefInfo.vValue.Integer = ADS_SCOPE_SUBTREE;

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

ADSI Enumerations, ADS_SEARCHPREF_ENUM, ADS_SEARCHPREF_INFO