Directory Services

IADsPropertyValue Property Methods

The property methods of the IADsPropertyValue interface provide access to the properties described in the following table. For more information, see Interface Property Methods.

Properties

Property Description
ADsType

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_ADsType
([out] LONG* ADsType);
HRESULT put_ADsType
([in] LONG ADsType);

The data type of the value of the property, taken from the ADSTYPEENUM enumeration, of the value property.
DNString

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_DNString
([out] BSTR* bstrDNString);
HRESULT put_DNString
([in] BSTR bstrDNString);

String that identifies the distinguished name (path) of a directory service value object.
CaseExactString

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_CaseExactString
([out] BSTR* bstrCaseExactString);
HRESULT put_CaseExactString
([in] BSTR bstrCaseExactString);

String to be interpreted. Case-sensitive.
CaseIgnoreString

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_CaseIgnoreString
([out] BSTR* bstrCaseIgnoreString);
HRESULT put_CaseIgnoreString
([in] BSTR bstrCaseIgnoreString);

String to be interpreted. Case insensitive.
PrintableString

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_PrintableString
([out] BSTR* bstrPrintableString);
HRESULT put_PrintableString
([in] BSTR bstrPrintableString);

Display or print string.
NumericString

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_NumericString
([out] BSTR* bstrNumericString);
HRESULT put_NumericString
([in] BSTR bstrNumericString);

Text to be interpreted. Numeric type.
Boolean

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_Boolean
([out] LONG* lnBoolean);
HRESULT put_Boolean
([in] LONG lnBoolean);

Boolean value.
Integer

[Visual Basic]
Access: Read/Write
DataType: LONG

[C++]
HRESULT get_Integer
([out] LONG* lnInteger);
HRESULT put_Integer
([in] LONG lnInteger);

Integer value.
OctetString

[Visual Basic]
Access: Read/Write
DataType: VARIANT

[C++]
HRESULT get_OctetString
([in] VARIANT* vOctetString);
HRESULT put_OctetString
([in] VARIANT* vOctetString);

Variant array of one-byte characters.
SecurityDescriptor

[Visual Basic]
Access: Read/Write
DataType: IDispatch

[C++]
HRESULT get_SecurityDescriptor
([out] IDispatch** ppSecurityDescriptor);
HRESULT put_SecurityDescriptor
([in] IDispatch* pSecurityDescriptor);

Pointer to the IDispatch interface of the object implementing IADsSecurityDescriptor for this value.
LargeInteger

[Visual Basic]
Access: Read/Write
DataType: IDispatch

[C++]
HRESULT get_LargeInteger
([out] IDispatch** ppLargeInteger);
HRESULT put_LargeInteger
([in] IDispatch* pLargeInteger);

Pointer to the IDispatch interface of the object implementing IADsLargeInteger for this value.
UTCTime

[Visual Basic]
Access: Read/Write
DataType: DATE

[C++]
HRESULT get_UTCTime
([out] DATE* daUTCTime);
HRESULT put_UTCTime
([in] DATE daUTCTime);

A date of the VT_DATE type expressed in Coordinated Universal Time (UTC) format.

Remarks

The IADsPropertyValue properties will only set or retrieve a property value of the specified type. For example, calling the CaseIgnoreString property (or get_CaseIgnoreString method) on a property of type ADSTYPE_DN_STRING (like the distinguishedName property) will result in an error. The CaseIgnoreString property (or get_CaseIgnoreString method will only work on properties of type ADS_CASE_IGNORE_STRING.

Example Code [Visual Basic]

The following code example shows how to retrieve a property from the property list.

Dim propList As IADsPropertyList
Dim propEntry As IADsPropertyEntry
Dim propVal As IADsPropertyValue

On Error GoTo Cleanup
 
' Retrieve the property list.
Set propList = GetObject("LDAP://dc01/DC=Fabrikam,DC=com")
propList.GetInfo
 
' Retrieve a property entry. If you are certain of the property type,
' replace ADSTYPE_UNKNOWN with the actual property type
Set propEntry = propList.GetPropertyItem("description", ADSTYPE_UNKNOWN)
 
' Print the property entry values.
For Each v In propEntry.Values
	Set propVal = v
	Select Case propVal.ADsType
		Case ADSTYPE_CASE_EXACT_STRING
			Debug.Print propVal.CaseExactString
		Case ADSTYPE_CASE_IGNORE_STRING
			Debug.Print propVal.CaseIgnoreString
		Case Else
			Debug.Print "Unable to handle a property of type: " & propVal.ADsType
	End Select

Next

Cleanup:
	If (Err.Number<>0) Then
	 Debug.Print "An error has occurred. " & Err.Number
	End If
	Set propList = Nothing
	Set propEntry = Nothing
	Set propVal = Nothing

Example Code [C++]

The following C++ code shows how to use IADsPropertyValue::get_CaseIgnoreString to retrieve the value of the description property from a property list.

#include <activeds.h>
#include <stdio.h>
 
IADsPropertyList *pList = NULL;
IADsPropertyEntry *pEntry = NULL;
IADsPropertyValue *pVal = NULL;
IADs *pObj = NULL;
VARIANT var, varItem;
BSTR valStr;
IEnumVARIANT *pEnum = NULL;
LONG lstart = 0;
LONG lend = 0;
LONG lADsType = ADSTYPE_UNKNOWN;
 
VariantInit(&var);
VariantInit(&varItem);
 
// Bind to the directory object.
HRESULT hr = ADsGetObject(L"LDAP://dc01/DC=Fabrikam,DC=com",
						IID_IADsPropertyList,
						(void**)&pList);

if(FAILED(hr)){goto Cleanup;}

// Initialize the property cache.
hr = pList->QueryInterface(IID_IADs,(void**)&pObj);
if(FAILED(hr)){goto Cleanup;}

pObj->GetInfo();
pObj->Release();
 
// Retrieve the property entry.
hr = pList->GetPropertyItem(CComBSTR("description"), ADSTYPE_CASE_IGNORE_STRING, &var);
pList->Release();
if(FAILED(hr)){goto Cleanup;}

hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry,
									(void**)&pEntry);
VariantClear(&var);
if(FAILED(hr)){goto Cleanup;}
 
// Retrieve the value array of the property entry.
hr = pEntry->get_Values(&var);
if(FAILED(hr)){goto Cleanup;}

SAFEARRAY *sa = V_ARRAY( &var );
 
// Retrieve the lower and upper bound. Iterate and print the values.
hr = SafeArrayGetLBound( sa, 1, &lstart );
hr = SafeArrayGetUBound( sa, 1, &lend );
printf(" Property value(s) = ");
for ( long idx=lstart; idx < lend+1; idx++ )	{
	hr = SafeArrayGetElement( sa, &idx, &varItem );
	hr = V_DISPATCH(&varItem)->QueryInterface(IID_IADsPropertyValue,
											(void**)&pVal);
	if(FAILED(hr)){goto Cleanup;}

	pVal->get_ADsType(&lADsType);

	switch(lADsType)
	{
		case ADSTYPE_CASE_IGNORE_STRING:
		{
			hr = pVal->get_CaseIgnoreString(&valStr);
			break;
	}
		case ADSTYPE_CASE_EXACT_STRING:
		{
			hr = pVal->get_CaseExactString(&valStr);
			break;
	}
		default:
		{
			valStr = SysAllocString(L"Unable to handle a property of this type");
			break;
	}
}

	if(FAILED(hr)){goto Cleanup;}
	printf(" %S ", valStr);
	SysFreeString(valStr);
	VariantClear(&varItem);
}
printf("\n");

Cleanup:
	if(pList)
		pList = NULL;

	if(pEntry)
		pEntry = NULL;

	if(pVal)
		pVal = NULL;

	if(pObj)
		pObj = NULL;

	if(pEnum)
		pEnum = NULL;

	SysFreeString(valStr);
	VariantClear(&varItem);
	VariantClear(&var);

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

ADSTYPEENUM, IADsPropertyEntry, IADsPropertyList, IADsPropertyValue2, IADsSecurityDescriptor, IDispatch