Platform SDK: Active Directory, ADSI, and Directory Services |
The IADsClass interface is designed for managing schema class objects that provide class definitions for any ADSI object. Other schema management interfaces include IADsProperty for attribute definitions and IADsSyntax for attribute syntax.
The IADsClass interface supports the following properties and methods.
IUnknown methods | Description |
---|---|
QueryInterface | Returns pointers to supported interfaces. |
AddRef | Increments reference count. |
Release | Decrements reference count. |
IDispatch methods | Description |
---|---|
GetTypeInfoCount | Gets the number of type descriptions. |
GetTypeInfo | Gets a description of the object's programmable interface. |
GetIDsOfNames | Maps the name of the method or property to DISPID. |
Invoke | Calls one of the object's methods, or gets and sets one of its properties. |
IADsClass properties and methods | Description |
---|---|
get_PrimaryInterface | Gets the identifier of the interface that defines this schema class. |
get/put_CLSID | Gets and sets the CLSID identifying application component that implements this schema class. |
get/put_OID | Gets and sets the directory-specific object identifier. |
get/put_Abstract | Gets and sets the flag in order to determine whether or not this schema class is abstract. |
get/put_Auxiliary | Gets and set the flag in order to determine whether or not this schema class is auxiliary. |
get/put_MandatoryProperties | Gets and sets a list of names of the mandatory properties an ADSI object must have. |
get/put_OptionalProperties | Gets and sets a list of names of optional properties an ADSI object may have. |
get/put_NamingProperties | Gets and sets a list of naming attributes for the schema object. |
get/put_DerivedFrom | Gets and sets the immediate super class of this schema class. |
get/put_AuxDerivedFrom | Gets and sets the immediate super Auxiliary class of this schema class. |
get/put_PossibleSuperiors | Gets and sets a list of classes that can contain instances of this class. |
get/put_Containment | Gets and sets legal objects types that can be contained within this container. |
get/put_Container | Gets and sets the flag to indicate whether or not this is a container object. |
get/put_HelpFileName | Gets and sets the name of an optional help file. |
get/put_HelpFileContext | Gets and sets the context identifier of an optional help file. |
Qualifiers | Returns a collection of ADSI objects that describe provider-specific qualifiers for the schema. |
Schema objects are organized in the schema container of a given directory. To access an object's schema class, use the object's Schema property (namely, call the IADs::get_Schema_ property method) to obtain the ADsPath string and use that string to bind to its schema class object.
The following Visual Basic® code snippet shows how to work with the IADsClass interface.
Dim obj As IADs Dim cls As IADsClass Set obj = GetObject("WinNT://myMachine,computer") Set cls = GetObject(obj.Schema) ' Inspecting mandatory and optional properties. For Each p in cls.MandatoryProperties MsgBox "Must-have: " & p Next For Each p in cls.OptionalProperties MsgBox "May-have: " & p Next
Here, p is the name of an attribute. For example, the computer object has an optional attribute known as Owner.
The following C++ code snippet shows how to work with the IADsClass interface.
HRESULT hr; IADsClass *pCls; IADs *pADs; BSTR bstrSchema, bstr; VARIANT var; hr = CoInitialize(NULL); hr = ADsGetObject(L"WinNT://myComputer,computer", IID_IADs, (void**)&pADs); if (FAILED(hr)) { return hr;} hr = pADs->get_Schema(&bstrSchema); pADs->Release(); if(FAILED(hr)) { return hr; } hr = ADsGetObject(bstrSchema, IID_IADsClass, (void**)&pCls); if(FAILED(hr)) { return hr; } VariantInit(&var); pCls->get_MandatoryProperties(&var); hr = printVarArray(var); VariantClear(&var); pCls->get_OptionalProperties(&var); hr = printVarArray(var); CoUninitialize();
The printVarArray function is implemented as follows:
HRESULT printVarArray(VARIANT var) { LONG lstart, lend; VARIANT varItem; HRESULT hr; SAFEARRAY *sa = V_ARRAY( &var ); hr = SafeArrayGetLBound( sa, 1, &lstart ); hr = SafeArrayGetUBound( sa, 1, &lend ); VariantInit(&varItem); for ( long idx=lstart; idx <= lend; idx++ ) { hr = SafeArrayGetElement( sa, &idx, &varItem ); printf(" %S \n", V_BSTR(&varItem)); VariantClear(&varItem); } printf("\n"); return S_OK; }
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
Windows 95/98: Requires Windows 95 or later (with DSClient).
Header: Declared in Iads.h.