Directory Services

Interface Property Methods

Many ADSI interfaces are designed to support Automation and, thus, are dual interfaces in that they support client access through both IUnknown and IDispatch interfaces. Non-Automation clients, such as those written in C/C++, resolve method invocation directly, using the IUnknown::QueryInterface, and call the method directly. Automation clients, also known as name-bound clients, such as those written in Visual BasicĀ®, or Visual BasicĀ® Scripting Edition (VBScript), must resolve method invocation indirectly with the help of the dispinterface method.

An ADSI interface supporting Automation defines property methods for retrieving and modifying properties of an object implementing the interface. The property methods have names that have get_ and put_ prepended to the appropriate property names, for example, get_User and put_Name.

Each get_<property> method takes a single parameter as output. This parameter is a method-allocated address of a variable of the property data type. On return, this variable assumes the current value of the requested property. The caller must release the allocated memory of the variable when the property is no longer needed.

Each put_<property> method takes a single parameter as input for the data type of the corresponding property. The parameter holds a new value of the property.

Invocation of the property methods in C++ follows the usual procedure to call the member function of an object, for example:

[C++]
IADs *pADs;
BSTR bstrName;
pADs->get_Name(&bstrName);

Invocation of the property methods in Automation clients can be somewhat different. Visual Basic uses the dot notation, for example:

[Visual Basic]
Dim Obj As IADs
Dim objName As String
objName = Obj.Name

All parameters and return types must be of those that the VARIANT data type defines. All methods on a dual interface return an HRESULT value to indicate success or failure.

For more information about getting and setting properties on ADSI objects, see Property Cache.