共用方式為


IADsPropertyList 屬性方法

IADsPropertyList介面的屬性方法會讀取下表所述的屬性。 如需詳細資訊,請參閱 Interface 屬性方法

屬性

PropertyCount

屬性清單中的專案數目。

存取類型:唯讀

腳本資料類型: LONG

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

範例

下列程式碼範例示範如何判斷屬性清單中的專案數目。

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

下列程式碼範例示範如何判斷屬性清單中的專案數目。

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

}

規格需求

需求
最低支援的用戶端
Windows Vista
最低支援的伺服器
Windows Server 2008
標頭
Iads.h
DLL
Activeds.dll
IID
IID_IADsPropertyList定義為 C6F602B6-8F69-11D0-8528-00C04FD8D503

另請參閱

IADsPropertyList

Interface 屬性方法