Metodi della proprietà IADsPropertyValue

I metodi di proprietà dell'interfaccia IADsPropertyValue forniscono l'accesso alle proprietà descritte nella tabella seguente. Per altre informazioni, vedere Metodi di proprietà dell'interfaccia.

Proprietà

ADsType

Tipo di dati del valore della proprietà, ricavato dall'enumerazione ADSTYPEENUM , della proprietà value.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: LONG

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

Boolean

.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: LONG

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

CaseExactString

Stringa da interpretare. Sensitive.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

CaseIgnoreString

Stringa da interpretare. Senza distinzione tra maiuscole e minuscole.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

DNString

Stringa che identifica il nome distinto (percorso) di un oggetto valore del servizio directory.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

Integer

Valore intero.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: LONG

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

LargeInteger

Puntatore all'interfaccia IDispatch dell'oggetto che implementa IADsLargeInteger per questo valore.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: IDispatch

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

NumericString

Testo da interpretare. Tipo numerico.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

OctetString

Matrice variante di caratteri a un byte.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: VARIANT

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

PrintableString

Visualizzare o stampare una stringa.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: BSTR

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

SecurityDescriptor

Puntatore all'interfaccia IDispatch dell'oggetto che implementa IADsSecurityDescriptor per questo valore.

Tipo di accesso: lettura/scrittura

Tipo di dati scripting: IDispatch

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

UTCTime

Data del tipo di VT_DATE espresso in formato UTC (Coordinated Universal Time).

Tipo di accesso: lettura/scrittura

Tipo di dati di scripting: DATE

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

Commenti

Le proprietà IADsPropertyValue imposteranno o recupereranno solo un valore della proprietà del tipo specificato. Ad esempio, la proprietà CaseIgnoreString su un attributo di tipo ADSTYPE_DN_STRING, come l'attributo distinguishedName , genererà un errore. La proprietà CaseIgnoreString funzionerà solo sugli attributi di tipo ADS_CASE_IGNORE_STRING. La tabella seguente esegue il mapping del valore ADSTYPEENUM alla proprietà IADsPropertyValue corrispondente che può essere utilizzata per accedere a tale tipo di attributo. Se un valore ADSTYPEENUM non è elencato in questa tabella, non è disponibile dall'interfaccia IADsPropertyValue . L'interfaccia IADsPropertyValue2 deve essere usata per ottenere i dati negli altri formati.

Valore ADSTYPEENUM Proprietà IADsPropertyValue
ADSTYPE_DN_STRING DNString
ADSTYPE_CASE_EXACT_STRING CaseExactString
ADSTYPE_CASE_IGNORE_STRING CaseIgnoreString
ADSTYPE_PRINTABLE_STRING PrintableString
ADSTYPE_NUMERIC_STRING NumericString
ADSTYPE_BOOLEAN Boolean
ADSTYPE_INTEGER Integer
ADSTYPE_OCTET_STRING OctetString
ADSTYPE_UTC_TIME UTCTime
ADSTYPE_LARGE_INTEGER LargeInteger
ADSTYPE_NT_SECURITY_DESCRIPTOR SecurityDescriptor

Esempio

Nell'esempio di codice seguente viene illustrato come recuperare una proprietà dall'elenco di proprietà.

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

Il codice seguente illustra come usare IADsPropertyValue::get_CaseIgnoreString per recuperare il valore della proprietà description da un elenco di proprietà.

#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);

Requisiti

Requisito Valore
Client minimo supportato
Windows Vista
Server minimo supportato
Windows Server 2008
Intestazione
Iads.h
DLL
Activeds.dll
IID
IID_IADsPropertyValue è definito come 79FA9AD0-A97C-11D0-8534-00C04FD8D503

Vedi anche

IADsPropertyValue

ADSTYPEENUM

IADsPropertyEntry

IADsPropertyList

IADsPropertyValue2

IADsSecurityDescriptor

Idispatch