Directory Services |
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.
Property | Description |
---|---|
OID
[Visual Basic] [C++] |
Directory-specific object identifier. |
Syntax
[Visual Basic] [C++] |
Relative path of syntax object. |
MaxRange
[Visual Basic] [C++] |
Upper limit of values. |
MinRange
[Visual Basic] [C++] |
Lower limit of values. |
MultiValued
[Visual Basic] [C++] |
Whether property supports single or multiple values. |
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
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();
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.