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 method, 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 using 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_ 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 required.

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

The following code example shows the invocation of the property methods that follow the usual procedure to call the member function of an object.

IADs *pADs;
BSTR bstrName;
pADs->get_Name(&bstrName);

The following code example shows the invocation of the property methods in automation clients, which can be somewhat different. For example, Visual Basic uses dot notation.

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.