Directory Services

IADsPropertyList Property Methods

The property methods of the IADsPropertyList interface read the properties described in the following table. For more information, see Interface Property Methods.

Properties

Property Description
PropertyCount

[Visual Basic]
Access: Read-only
DataType: Long

[C++]
HRESULT get_PropertyCount
([out] LONG* plCount);

The number of items in the property list.

Example Code [Visual Basic]

The following code example shows how to determine number of items in a property list.

Dim propList As IADsPropertyList
Dim count As Long

On Error GoTo Cleanup
 
Set propList = GetObject("LDAP://dc01/DC=Fabrikam,DC=com")
 
propList.GetInfo
count = propList.PropertyCount
Debug.Print "Number of Properties Found: " & count

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If

	Set propList = Nothing

Example Code [C++]

The following code example shows how to determine number of items in a property list.

int GetPropertyCacheCount(LPWSTR adsPath)
{
	IADsPropertyList *pList;
	IADs *pObj;
	HRESULT hr = S_OK;

	if(!adsPath)
	{
		_tprintf(TEXT("Invalid ADsPath."));
		return -1;
}

	HRESULT hr = ADsGetObject(adsPath,
						IID_IADsPropertyList,
						(void**)&pList);
	// Initialize the property cache.
	hr = pList->QueryInterface(IID_IADs,(void**)&pObj);
	pObj->GetInfo();
	pObj->Release();

	// Get the property count.
	hr = pList->get_PropertyCount(&count);
	pList->Release();

	// Return the property count if it succeeded, otherwise
	// return -1.

	if(SUCCEEDED(hr))
	{
		return count;
}
	else
	{
		return -1;
}

}

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

IADsPropertyList, Interface Property Methods