IADsPropertyEntry-Eigenschaftsmethoden

Die Eigenschaftenmethoden der IADsPropertyEntry-Schnittstelle bieten Zugriff auf die folgenden Eigenschaften. Weitere Informationen zu Eigenschaftenmethoden finden Sie unter Schnittstelleneigenschaftsmethoden.

Eigenschaften

ADsType

Der Datentyp der Name-Eigenschaft. Die Werte des Datentyps werden in der ADSTYPEENUM-Enumeration definiert.

Zugriffstyp: Lesen/Schreiben

Skriptdatentyp: LONG

// C++ method syntax
HRESULT get_ADsType(
  [out] LONG* plADsType
);
HRESULT put_ADsType(
  [in] LONG lADsType
);

ControlCode

Eine Konstante, die den Vorgang angibt, der für die benannte Eigenschaft ausgeführt werden soll. Der Wert wird in der ADS _ PROPERTY OPERATION _ _ ENUM-Enumeration definiert.

Zugriffstyp: Lesen/Schreiben

Skriptdatentyp: LONG

// C++ method syntax
HRESULT get_ControlCode(
  [out] LONG* pControlCode
);
HRESULT put_ControlCode(
  [in] LONG lnControlCode
);

Name

Name des Eigenschafteneintrags. Dieser Name sollte dem Namen eines Attributs entsprechen, wie im Schema definiert.

Zugriffstyp: Lesen/Schreiben

Skriptdatentyp: BSTR

// C++ method syntax
HRESULT get_Name(
  [out] BSTR* pbstrName
);
HRESULT put_Name(
  [in] BSTR bstrName
);

Werte

Ein VARIANT-Array. Jedes Element in diesem Array stellt einen Wert der benannten Eigenschaft dar. Solche Eigenschaftswerte werden durch ADSI-Objekte dargestellt, die die Schnittstellen IADsPropertyValue und IADsPropertyValue2 implementieren. Daher enthält das VARIANT-Array ein Array von Zeigern auf die IDispatch-Schnittstelle der ADSI-Objekte, die die Schnittstellen IADsPropertyValue und IADsPropertyValue2 implementieren.

Zugriffstyp: Lesen/Schreiben

Skriptdatentyp: VARIANT

// C++ method syntax
HRESULT get_Values(
  [out] VARIANT* pvValues
);
HRESULT put_Values(
  [in] VARIANT vValues
);

Hinweise

Jede Eigenschaftsmethode unterstützt die HRESULT-Standard-Rückgabewerte, einschließlich S _ OK. Weitere Informationen zu anderen Rückgabewerten finden Sie unter ADSI-Fehlercodes.

Beispiele

Das folgende Codebeispiel zeigt, wie eine benannte Eigenschaft aus dem Cache abgerufen und ein neuer Eigenschafteneintrag erstellt wird.

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

On Error GoTo Cleanup

'------------------------------------------------------------
'----- Getting IADsPropertyEntry ----------------------------
'------------------------------------------------------------
 
' Create the property list object.
Set propList = GetObject("LDAP://dc01/DC=Fabrikam,DC=com")
propList.GetInfo
 
' Get a named property entry object.
Set propEntry = propList.GetPropertyItem("dc", ADSTYPE_CASE_IGNORE_STRING)

' Insert code to do something with propEntry
Set propEntry = Nothing
 
'------------------------------------------------------------
'---- 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
 
'---- Create 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

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

Das folgende Codebeispiel zeigt, wie sie eine benannte Eigenschaft aus einem Cache erhalten.

#include <activeds.h>
#include <stdio.h>
 
IADsPropertyList *pList = NULL;
IADsPropertyEntry *pEntry = NULL;
IADs *pObj = NULL;
VARIANT var;
long valType = ADSTYPE_CASE_IGNORE_STRING;
 
VariantInit(&var);
 
// Bind to directory object.
HRESULT hr = ADsGetObject(L"LDAP://dc01/DC=Fabrikam,DC=com",
                          IID_IADsPropertyList,
                          (void**)&pList);
if(FAILED(hr)){return;}
 
// Initialize the property cache.
hr = pList->QueryInterface(IID_IADs,(void**)&pObj);
if(FAILED(hr)){goto Cleanup;}
pObj->GetInfo();
pObj->Release();
 
// Get a property entry.
hr = pList->GetPropertyItem(CComBSTR("description"), valType, &var);
pList->Release();
if(FAILED(hr)){goto Cleanup;}
hr = V_DISPATCH(&var)->QueryInterface(IID_IADsPropertyEntry,
                                      (void**)&pEntry);
VariantClear(&var);
if(FAILED(hr)){goto Cleanup;}
 
// Get the name and the type of the property entry.
BSTR nm = NULL;
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);

Cleanup:
    if(nm)
        SysFreeString(nm);

    if(pList)
        pList->Release();

    if(pEntry)
        pEntry->Release();

    if(pObj)
        pObj->Release();

    VariantClear(&var);

Anforderungen

Anforderung Wert
Unterstützte Mindestversion (Client)
Windows Vista
Unterstützte Mindestversion (Server)
Windows Server 2008
Header
Iads.h
DLL
Activeds.dll
IID
IID _ IADsPropertyEntry ist als 05792C8E-941F-11D0-8529-00C04FD8D503 definiert.

Siehe auch

_ENUM FÜR _ _ ADS-EIGENSCHAFTSVORGANG

ADSI-Fehlercodes

ADSTYPEENUM

IADsPropertyEntry

IADsPropertyValue

IADsPropertyValue2

IDispatch