Platform SDK: Active Directory, ADSI, and Directory Services

IADsPropertyEntry Property Methods

The property methods of the IADsPropertyEntry interface provide access to the following properties. For a general discussion on property methods, see Interface Property Methods.

Properties in Vtable Order

Property Description
Name

[Visual Basic]
Access: Read/Write
Data Type: BSTR

[C++]
HRESULT get_Name
([out] BSTR *pbstrName);


HRESULT put_Name
(
[in] BSTR bstrName);

Name of the property entry. This name should correspond to the name of an attribute as defined in the schema.
ADsType

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_ADsType
([out] LONG *plADsType);

HRESULT put_ADsType
(
[in] LONG lADsType);

The data type of the Name property. The values of the data type is defined in the ADSTYPEENUM enumeration.
ControlCode

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_ControlCode
([out] LONG *pControlCode);

HRESULT put_ControlCode
([in] LONG lnControlCode);

A constant that specify the operation to be performed on the named property. The value is defined in the ADS_PROPERTY_OPERATION_ENUM enumeration.
Values

[Visual Basic]
Access: Read/Write
Data Type: VARIANT

[C++]
HRESULT get_Values
(
[out] VARIANT *pvValues);

HRESULT put_Values
(
[in] VARIANT vValues);

A VARIANT array. Each element in this array represents a value of the named property. Such property values are represented by ADSI objects implementing the IADsPropertyValue interfaces. Therefore, the VARIANT array holds an array of pointers to the IDispatch interface on the ADSI objects implementing the IADsPropertyValue interface.

Return Values

Each property method supports the standard HRESULT return values, including S_OK. For other return values, see ADSI Error Codes.

Code Example [Visual Basic]

The following Visual Basic® code snippet shows how to retrieve a named property from the cache and create a new property entry.

 
'------------------------------------------------------------
'  --- Getting IADsPropertyEntry ----------------------------
'------------------------------------------------------------
 
' create the property list object
Set propList = GetObject("LDAP://dc01/DC=Microsoft,DC=com")
propList.GetInfo
 
' get a named property entry object.
Set propEntry = propList.GetPropertyItem("dc", ADSTYPE_CASE_IGNORE_STRING)
 
'------------------------------------------------------------
'--- Setting IADsPropertyEntry ------------------------------
'------------------------------------------------------------
 
' create a property value object
Set propVal = New PropertyValue
 
'--- Property Value-----
propVal.CaseIgnoreString = "Fabrikam, Inc - Seattle, WA"
propVal.ADsType = ADSTYPE_CASE_IGNORE_STRING
 
'—Make a new Property Entry ----
Set propEntry = New PropertyEntry
propEntry.Name = "adminDescription"
propEntry.Values = Array(propVal)
propEntry.ControlCode = ADS_PROPERTY_UPDATE
propEntry.ADsType = ADS_CASE_IGNORE_STRING
 
' --- Put the newly created property entry to the cache----
propList.PutPropertyItem (propEntry)
 
' commit the entry to the directory store.
propList.SetInfo

Code Example [C++]

The following C++ code snippet shows how to retrieve a named property from a cache:

#include <activeds.h>
#include <stdio.h>
 
IADsPropertyList *pList;
IADsPropertyEntry *pEntry;
IADs *pObj;
VARIANT var;
long valType = ADSTYPE_CASE_IGNORE_STRING;
 
VariantInit(&var);
 
// bind to directory object
HRESULT hr = ADsGetObject(L"LDAP://dc01/DC=Microsoft,DC=com",
                          IID_IADsPropertyList,
                          (void**)&pList);
 
// initialize the property cache
hr = pList->QueryInterface(IID_IADs,(void**)&pObj);
pObj->GetInfo();
pObj->Release();
 
// get a property entry
hr = pList->GetPropertyItem(L"description", valType, &var);
pList->Release();
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry,
                                      (void**)&pEntry);
VariantClear(&var);
 
// get the name and the type of the property entry
BSTR nm;
hr = pEntry->get_Name(&nm);
printf("Property name = %S\n",nm);
VariantClear(&var);
long at;
hr = pEntry->get_ADsType(&at);
printf("Property type = %d\n",a);

See Also

ADS_PROPERTY_OPERATION_ENUM, ADSI Error Codes, ADSTYPEENUM, IADsPropertyEntry, IADsPropertyValue, IDispatch