Platform SDK: Active Directory, ADSI, and Directory Services

IADsProperty

The IADsProperty interface is designed to manage a single attribute definition for a schema class object. An attribute definition specifies the minimum and maximum values of a property, its syntax, and whether the property supports multiple values. Other interfaces involved in schema management include IADsClass and IADsSyntax.

IADsProperty exposes methods to describe a property by name, syntax, value ranges, and any other attributes that have been defined. A property can have multiple names associated with it. But providers are required to ensure that all names are unique.

You can use the IADsProperty interface to determine at run time the attribute definition of a property supported by a directory service object. The following procedure describes how this can be done.

  1. Bind to the ADSI object's schema class object.
  2. Enumerate mandatory or optional attributes accessible from the schema class object. Skip this step if you know that the object supports the attribute of your interest.
  3. Bind to the schema container of the schema class object as obtained in Step 1.
  4. Retrieve from the schema container the attribute definition object of the property of interest.
  5. Examine the attribute definition of the property. This may require you to inspect the syntax object as well.

Example Code [Visual Basic]

The following code example illustrates the procedure above for applying the IADsProperty interface to determine attribute definitions of a property.

Dim obj As IADs
Dim cl As IADsClass
Dim pr As IADsProperty
Dim sy As IADsSyntax
Dim sc As IADsContainer
 
' Step 1
Set obj = GetObject("WinNT://myMachine,computer")
Set cl = GetObject(obj.Schema)
 
' Step 2
' Skip it, assuming the "Owner" attribute is supported by obj.
' For the computer object in this example, it is indeed one of 
' the supported optional properties.
 
' step 3
Set sc = GetObject(cl.Parent)
 
' Step 4
Set pr = sc.GetObject("Property","Owner")
 
' Step 5
MsgBox "Attribute: " & pr.Name
MsgBox "Syntax:    " & pr.Syntax
If pr.Multivalued = True Then
    MsgBox "The Owner attribute has multiple values."
Else
    MsgBox "The Owner attribute has a single value."
End If
 
' To further examine the syntax
Set sy = GetObject(sc.AdsPath & "/" & pr.Syntax)
MsgBox "Syntax object: " & sy.Name & " of OleAutoDataType: " & sy.OleAutoDataType

The IADsProperty interface's methods can also be used to add new attributes and property objects to a provider-specific implementation.

The IADsProperty interface supports the following properties and methods.

Methods in Vtable Order

IUnknown methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments reference count.
Release Decrements reference count.

IDispatch methods Description
GetTypeInfoCount Gets the number of type descriptions.
GetTypeInfo Gets a description of the object's programmable interface.
GetIDsOfNames Maps the name of the method or property to DISPID.
Invoke Calls one of the object's methods, or gets and sets one of its properties.

IADsProperty property methods Description
get/put_OID Directory-specific object identifier.
get/put_Syntax Relative path of the syntax object.
get/put_MaxRange Upper limit of values.
get/put_MinRange Lower limit of values.
get/put_MultiValued Whether or not this is a property that supports multiple values.
Qualifiers Optional additional provider-specific constraints on this property.

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

IADsClass, IADsProperty