Class ADQuery API

Query objects from Active Directory via LDAP.

Version:

1.1, 2012-10-29

Author:

Ansgar Wiechers <ansgar.wiechers@planetcobalt.net>

Property Summary

Attributes

Array with the names of the attributes the query should return.


CacheResults

Indicates whether or not the results of the query should be cached.


ChaseReferrals

Indicates whether or not referrals should be chased.


Filter

LDAP filter for the query.


PageSize

Number of records per logical page of data.


Scope

The scope of the query.


SearchBase

The search base for the query.


Timeout

Timeout for the AD command in seconds.

Method Summary

Execute()

Run an AD query with the configured parameters.


Init(base, filter, attr, scope)
default

Initialization method to allow for setting all main properties at the same time.

Property Detail

Attributes

Attributes
read-write

Array with the names of the attributes the query should return. The default is "distinguishedName".

Raises:

Invalid argument (450)


CacheResults

CacheResults
read-write

Indicates whether or not the results of the query should be cached. The default is False.

Raises:

Invalid argument (450)


ChaseReferrals

ChaseReferrals
read-write

Indicates whether or not referrals should be chased. For simplicity reasons this property only allows for chasing either all or no referrals. The default is True (chase all referrals).

This behavior is different from the named property of the ADO command object, which allows to selectively chase referrals to external and/or subordinate domains and defaults to not chasing referrals.

Raises:

Invalid argument (450)

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa772250%28v=vs.85%29.aspx (ADS_CHASE_REFERRALS_ENUM enumeration)


Filter

Filter
read-write

LDAP filter for the query. The default is to query for user objects.

Raises:

Argument must be a string (450)

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa746475%28v=vs.85%29.aspx (Search Filter Syntax)


PageSize

PageSize
read-write

Number of records per logical page of data. Must be a postivie integer. The default is 1000.

Raises:

Invalid argument (450)

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681431%28v=vs.85%29.aspx (PageSize Property)


Scope

Scope
read-write

The scope of the query. Valid scopes are defined in the ADS_SCOPEENUM enumeration:

The default is 2 (subtree).

Raises:

Invalid scope (450)

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa772286%28v=vs.85%29.aspx (ADS_SCOPEENUM enumeration)


SearchBase

SearchBase
read-write

The search base for the query. Must be an LDAP distinguished name (e.g. "ou=foo,dc=example,dc=com"). Default is the default naming context of the computer's domain.

Raises:

Malformed distinguished name (450)


Timeout

Timeout
read-write

Timeout for the AD command in seconds. Must be a positive integer. The default is 30 seconds.

Raises:

Invalid argument (450)

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms678265%28v=vs.85%29.aspx (CommandTimeout Property)

Method Detail

Execute

Public Execute()

Run an AD query with the configured parameters.

Returns:

An ADO recordset with the results returned by the query or Nothing.

See also:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681510%28v=vs.85%29.aspx (ADO Recordset Object)


Init

Public Default Init(base, filter, attr, scope)

Initialization method to allow for setting all main properties at the same time. Null values leave the respective property unchanged.

Parameters:

base - The LDAP search base.

filter - LDAP filter to restrict the returned objects.

attr - The attributes to be retrieved by the query.

scope - The scope for the query.

Returns:

The initialized object.

Created with VBSdoc.