Share via


Metodi di proprietà IADsPropertyList

I metodi di proprietà dell'interfaccia IADsPropertyList legge le proprietà descritte nella tabella seguente. Per altre informazioni, vedere Metodi di proprietà dell'interfaccia.

Proprietà

PropertyCount

Numero di elementi nell'elenco delle proprietà.

Tipo di accesso: sola lettura

Tipo di dati di scripting: LONG

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

Esempio

Nell'esempio di codice seguente viene illustrato come determinare il numero di elementi in un elenco di proprietà.

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

Nell'esempio di codice seguente viene illustrato come determinare il numero di elementi in un elenco di proprietà.

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;
    }

}

Requisiti

Requisito Valore
Client minimo supportato
Windows Vista
Server minimo supportato
Windows Server 2008
Intestazione
Iads.h
DLL
Activeds.dll
IID
IID_IADsPropertyList è definito come C6F602B6-8F69-11D0-8528-00C04FD8D503

Vedi anche

IADsPropertyList

Metodi di proprietà Interface