Directory Services

IADsSyntax Property Methods

The property methods of the IADsSyntax interface get or set the properties described in the following table. For more information about property methods, see Interface Property Methods.

Properties

Property Description
OleAutoDataType

[Visual Basic]
Access: Read/Write
DataType: 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 Description
VT_BOOL VT_BSTR VT_BSTRT VT_CY VT_DATE VT_EMPTY VT_ERROR VT_I2 VT_I4 VT_R4 VT_R8 VT_UI1 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 code example 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
On Error GoTo Cleanup

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

Cleanup:
	If (Err.Number<>0) Then
		MsgBox("An error has occurred. " & Err.Number)
	End If
	Set obj = Nothing
	Set cl = Nothing
	Set pr = Nothing
	Set sy = Nothing
	Set sc = Nothing

Example Code [C++]

The following code example 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>
#include <atlbase.h>
 
IADs *pObj = NULL;
IADsClass *pCls = NULL;
IADsProperty *pProp = NULL;
IADsSyntax *pSyn = NULL;
IADsContainer *pCont = NULL;
 
HRESULT hr = ADsGetObject(L"WinNT://myMachine,computer",
						IID_IADs,
						(void**)&pObj);
if(FAILED(hr)){goto Cleanup;}
VARIANT var;
VariantInit(&var);
CComBSTR sbstr;
 
pObj->get_Schema(&sbstr);
printf("Object schema: %S\n",sbstr);
 
hr = ADsGetObject(sbstr, IID_IADsClass,(void**)&pCls);
if(FAILED(hr)){goto Cleanup;}

pCls->get_Parent(&sbstr);
printf("Object class's container:  %S\n", sbstr);
 
hr = ADsGetObject(sbstr, IID_IADsContainer, (void**)&pCont);
if(FAILED(hr)){goto Cleanup;}
pCont->QueryInterface(IID_IADs,(void**)&pObj);
pObj->get_ADsPath(&sbstr);
printf("Container's AdsPath:  %S\n",sbstr);
 
IDispatch *pDisp;
hr = pCont->GetObject(CComBSTR("Property"),
					CComBSTR("OperatingSystemVersion"),
					(IDispatch**)&pDisp);
if(FAILED(hr)){goto Cleanup;}
 
hr = pDisp->QueryInterface(IID_IADsProperty, (void**)&pProp);
if(FAILED(hr)){goto Cleanup;}
 
hr = pProp->get_Syntax(&sbstr);
if(FAILED(hr)){goto Cleanup;}
printf("Property Syntax:  %S\n",sbstr);
 
printf("ADsPath of the syntax object %S\n",sbstr);
 
hr = ADsGetObject(sbstr, IID_IADsSyntax, (void**)&pSyn);
if(FAILED(hr)){goto Cleanup;}

long lType;
pSyn->get_OleAutoDataType(&lType);
printf("Property syntax's OleAutoDataType: %d\n", lType);

Cleanup:
	if(pObj)
		pObj->Release();

	if(pProp)
		pProp->Release();

	if(pCls)
		pCls->Release();

	if(pSyn)
		pSyn->Release();

	if(pCont)
		pCont->Release();

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Iads.h.

See Also

IADsClass, IADsProperty, IADsSyntax