Platform SDK: Active Directory, ADSI, and Directory Services

Providing Direct Access to the Property Cache

In addition to the IADs methods that get and set individual properties in the cache, ADSI provides the IADsPropertyList, IADsPropertyEntry, and IADsPropertyValue interfaces that allow client software to access the property cache directly. These interfaces allow you to work with the properties without having to use the individual property names.

Interface Purpose
IADsPropertyList Manage the entire list of properties defined on an object.
IADsPropertyEntry Manage individual property attributes and values.
IADsPropertyValue Read and write values for each property entry in the property cache.

The ADSI property-cache interfaces represent each property entry. IADsPropertyEntry allows access to a single property in the cache and includes a pointer to the list of IADsPropertyValue pointers needed to represent each value.

The IADsPropertyList interface manages a property list node in a namespace. With this interface, you can enumerate the properties in the list, add and remove properties, or purge the entire list in one step.

Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry
Dim propValue As IADsPropertyValue
Dim rootDSE As IADs
 
'Get the rootDSE entry that contains configuration information
Set rootDSE = GetObject("LDAP://RootDSE")
 
'Bind to the domain
Set propList = GetObject("LDAP://" & rootDSE.Get("defaultNamingContext"))
 
'Get the Property Entries
 
Set propEntry = propList.GetPropertyItem("allowedChildClassesEffective", ADSTYPE_CASE_IGNORE_STRING)
 
'Get more info about Property Entry
Debug.Print propEntry.ADsType
Debug.Print propEntry.ControlCode
Debug.Print propList.PropertyCount
 
'Values contain pointers to IADsPropertyValues interfaces
For Each v In propEntry.Values
    Set propValue = v
    Debug.Print propValue.CaseIgnoreString
Next