Directory Services

IADsProperty Property Methods

The property methods of the IADsProperty interface read and write the properties described in the following table. For more information about property methods, see Interface Property Methods.

Properties

Property Description
OID

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_OID
([out] BSTR* bstrOID);
HRESULT put_OID
([out] BSTR* bstrOID);

Directory-specific object identifier.
Syntax

[Visual Basic]
Access: Read/Write
DataType: BSTR

[C++]
HRESULT get_Syntax
([out] BSTR* bstrSyntax);
HRESULT put_Syntax
([in] BSTR* bstrSyntax);

Relative path of syntax object.
MaxRange

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_MaxRange
([out] LONG* lnMaxRange);
HRESULT put_MaxRange
([in] LONG lnMaxRange);

Upper limit of values.
MinRange

[Visual Basic]
Access: Read/Write
DataType: Long

[C++]
HRESULT get_MinRange
([out] LONG* lnMinRange);
HRESULT put_MinRange
([in] LONG lnMinRange);

Lower limit of values.
MultiValued

[Visual Basic]
Access: Read/Write
DataType: Boolean

[C++]
HRESULT get_MultiValued
([out] VARIANT_BOOL* fMultivalued);
HRESULT put_MultiValued
([in] VARIANT_BOOL fMultivalued);

Whether property supports single or multiple values.

Example Code [Visual Basic]

The following code example examines the OperatingSystem attribute of a computer on a network through the WinNT provider.

Dim obj As IADs
Dim cl As IADsClass
Dim pr As IADsProperty
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","OperatingSystem")
 
MsgBox "Attribute:  " & pr.Name
MsgBox "Syntax:	 " & pr.Syntax
MsgBox "MaxRange:   " & pr.MaxRange
MsgBox "MinRange:   " & pr.MinRange
MsgBox "Multivalued:" & pr.Multivalued

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 sc = Nothing

Example Code [C++]

The following code example examines the OperatingSystem attribute of a computer on a network through the WinNT provider. For brevity, error checking is omitted.

IADs *pADs = NULL;
IADsClass *pCls = NULL;
IADsProperty* pProp = NULL;
IADsContainer *pCont = NULL;
long lval;
short bval;
HRESULT hr = CoInitialize(NULL);
 
hr = ADsGetObject(L"WinNT://myMachine,computer",
				IID_IADs, (void**)&pADs);
if(FAILED(hr))
	goto Cleanup;

BSTR bstr;
hr = pADs->get_Schema(&bstr);
if(FAILED(hr))
	goto Cleanup;

hr = ADsGetObject(bstr, IID_IADsClass, (void**)&pCls);
hr = pCls->get_Parent(&bstr);
if(FAILED(hr))
	goto Cleanup;

hr = ADsGetObject(bstr, IID_IADsContainer, (void**)&pCont);
if(FAILED(hr))
	goto Cleanup;
SysFreeString(bstr);

hr = pCont->GetObject(CComBSTR("Property"), CComBSTR("OperatingSystem"), (IDispatch**)&pProp);
if(FAILED(hr))
	goto Cleanup;

hr = pProp->get_Name(&bstr);
if(FAILED(hr))
	goto Cleanup;
printf(" Name : %S\n",bstr);
SysFreeString(bstr);

hr = pProp->get_Syntax(&bstr);
if(FAILED(hr))
	goto Cleanup;
printf(" Syntax : %S\n",bstr);
SysFreeString(bstr);

hr = pProp->get_MaxRange(&lval);
if(FAILED(hr))
	goto Cleanup;
printf(" MaxRange : %d\n",lval);
SysFreeString(bstr);

hr = pProp->get_MinRange(&lval);
if(FAILED(hr))
	goto Cleanup;
printf(" MinRange : %d\n", lval);
SysFreeString(bstr);

hr = pProp->get_Multivalued(&bval);
if(FAILED(hr))
	goto Cleanup;
printf(" MultiValued : %b\n",bval);
SysFreeString(bstr);

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

	if(pCls)
		pCls->Release();

	if(pCont)
		pCont->Release();

	if(pProp)
		pProp->Release(); 
 
CoUninitialize();

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