Platform SDK: Active Directory, ADSI, and Directory Services

IADsSyntax Property Methods

The property methods of the IADsSyntax interface get or set the properties described in the following table. For a general discussion of property methods, see Interface Property Methods.

Properties in Vtable Order

Property Description
OleAutoDataType

[Visual Basic]
Access: Read/Write
Data Type: LONG

[C++]
HRESULT get_OleAutoDataType
([out] LONG *plAutoDataType);


HRESULT put_OleAutoDataType
([in] LONG lAutoDataType);

Gets and sets a LONG that contains the value of the VT_xxx constant for the Automation data type that represents this syntax.






Active Directory™ supports the following Automation data types:

  Virtual Types
VT_BOOL
VT_BSTR
VT_BSTRT
VT_CY
VT_DATE
VT_EMPTY
VT_ERROR
VT_I2
VT_I4
VT_R4
VT_R8
VT_UI1
Description
BOOL
BSTR
BSTRT
CURRENCY
Date
NULL
Invalid
short
long
real
double
BYTE

Remarks

An array of unsigned bytes, VT_UI1|VT_ARRAY could mean that the provider has mapped a syntax that cannot be mapped to an Automation virtual type.

Example Code [Visual Basic]

The following Visual Basic® code snippet examines the syntax of the OperatingSystemVersion attribute of a computer on a network through the WinNT provider. The resultant syntax is a string.

Dim obj As IADs
Dim cl As IADsClass
Dim pr As IADsProperty
Dim sy As IADsSyntax
Dim sc As IADsContainer
 
Set obj = GetObject("WinNT://myMachine,computer")
Set cl = GetObject(obj.Schema)
Set sc = GetObject(cl.Parent)
Set pr = sc.GetObject("Property","OperatingSystemVersion")
Set sy = GetObject(sc.ADsPath & "/" & pr.Syntax)
 
MsgBox "Automation data types: " & sy.OleAutoDataType

Example Code [C++]

The following C++ code snippet examines the syntax of the OperatingSystemVersion attribute of a computer on a network through the WinNT provider. The resultant syntax is a string. For brevity, error checking is omitted.

#include <stdio.h>
#include <activeds.h>
 
IADs *pObj;
IADsClass *pCls;
IADsProperty *pProp;
IADsSyntax *pSyn;
IADsContainer *pCont;
 
HRESULT hr = ADsGetObject(L"WinNT://myMachine,computer",
                          IID_IADs,
                          (void**)&pObj);
VARIANT var;
VariantInit(&var);
BSTR bstr;
 
pObj->get_Schema(&bstr);
pObj->Release();
printf("Object schema: %S\n",bstr);
 
hr = ADsGetObject(bstr, IID_IADsClass,(void**)&pCls);
pCls->get_Parent(&bstr);
pCls->Release();
printf("Object class's container:  %S\n", bstr);
 
hr = ADsGetObject(bstr, IID_IADsContainer, (void**)&pCont);
pCont->QueryInterface(IID_IADs,(void**)&pObj);
pCont->Release();
pObj->get_ADsPath(&bstr);
printf("Container's AdsPath:  %S\n",bstr);
 
IDispatch *pDisp;
hr = pCont->GetObject(L"Property",
                      L"OperatingSystemVersion",
                      (IDispatch**)&pDisp);
pCont->Release();
 
pDisp->QueryInterface(IID_IADsProperty, (void**)&pProp);
pDisp->Release();
 
BSTR bstr1;
pProp->get_Syntax(&bstr1);
pProp->Release();
printf("Property Syntax:  %S\n",bstr1);
 
wcscat(bstr, L"/");
wcscat(bstr, bstr1);
printf("ADsPath of the syntax object %S\n",bstr);
 
hr = ADsGetObject(bstr, IID_IADsSyntax, (void**)&pSyn);
long lType;
pSyn->get_OleAutoDataType(&lType);
printf("Property syntax's OleAutoDataType: %d\n", lType);
pSyn->Release();
 
SysFreeString(bstr);
SysFreeString(bstr1);

See Also

IADsClass, IADsProperty, IADsSyntax