Directory Services

IADsClass

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.

Methods in Vtable Order

The IADsClass interface inherits the methods of the standard COM interfaces:

In addition, IADsClass defines the following methods.

Method Description
get_PrimaryInterface Gets the identifier of the interface that defines this schema class.
get_CLSID Gets and sets the CLSID identifying application component that implements this schema class.
put_CLSID Gets and sets the CLSID identifying application component that implements this schema class.
get_OID Gets and sets the directory-specific object identifier.
put_OID Gets and sets the directory-specific object identifier.
get_Abstract Gets and sets the flag in order to determine whether or not this schema class is abstract.
put_Abstract Gets and sets the flag in order to determine whether or not this schema class is abstract.
get_Auxiliary Gets and set the flag in order to determine whether or not this schema class is auxiliary.
put_Auxiliary Gets and set the flag in order to determine whether or not this schema class is auxiliary.
get_MandatoryProperties Gets and sets a list of names of the mandatory properties an ADSI object must have.
put_MandatoryProperties Gets and sets a list of names of the mandatory properties an ADSI object must have.
get_OptionalProperties Gets and sets a list of names of optional properties an ADSI object may have.
put_OptionalProperties Gets and sets a list of names of optional properties an ADSI object may have.
get_NamingProperties Gets and sets a list of naming attributes for the schema object.
put_NamingProperties Gets and sets a list of naming attributes for the schema object.
get_DerivedFrom Gets and sets the immediate super class of this schema class.
put_DerivedFrom Gets and sets the immediate super class of this schema class.
get_AuxDerivedFrom Gets and sets the immediate super Auxiliary class of this schema class.
put_AuxDerivedFrom Gets and sets the immediate super Auxiliary class of this schema class.
get_PossibleSuperiors Gets and sets a list of classes that can contain instances of this class.
put_PossibleSuperiors Gets and sets a list of classes that can contain instances of this class.
get_Containment Gets and sets legal objects types that can be contained within this container.
put_Containment Gets and sets legal objects types that can be contained within this container.
get_Container Gets and sets the flag to indicate whether or not this is a container object.
put_Container Gets and sets the flag to indicate whether or not this is a container object.
get_HelpFileName Gets and sets the name of an optional help file.
put_HelpFileName Gets and sets the name of an optional help file.
get_HelpFileContext Gets and sets the context identifier of an optional help file.
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.

Properties

The IADsClass interface defines the following properties. The preceding table includes access methods for these properties.

Property Description
Abstract Gets and sets the flag in order to determine whether or not this schema class is abstract.
AuxDerivedFrom Gets and sets the immediate super Auxiliary class of this schema class.
Auxiliary Gets and set the flag in order to determine whether or not this schema class is auxiliary.
CLSID Gets and sets the CLSID identifying application component that implements this schema class.
Container Gets and sets the flag to indicate whether or not this is a container object.
Containment Gets and sets legal objects types that can be contained within this container.
DerivedFrom Gets and sets the immediate super class of this schema class.
HelpFileContext Gets and sets the context identifier of an optional help file.
HelpFileName Gets and sets the name of an optional help file.
MandatoryProperties Gets and sets a list of names of the mandatory properties an ADSI object must have.
NamingProperties Gets and sets a list of naming attributes for the schema object.
OID Gets and sets the directory-specific object identifier.
OptionalProperties Gets and sets a list of names of optional properties an ADSI object may have.
PossibleSuperiors Gets and sets a list of classes that can contain instances of this class.
PrimaryInterface Gets the identifier of the interface that defines this schema class.

Remarks

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.

Example Code [Visual Basic]

The following code example shows how to implement the IADsClass interface.

Dim obj As IADs
Dim cls As IADsClass

On Error GoTo Cleanup

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

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

Example Code [C++]

The following code example shows how to implement the IADsClass interface.

HRESULT hr = S_OK;
IADsClass *pCls = NULL;
IADs *pADs;
BSTR bstrSchema;
VARIANT var;
 
hr = CoInitialize(NULL);
hr = ADsGetObject(L"WinNT://myComputer,computer",
				IID_IADs,
				(void**)&pADs);
if (FAILED(hr)) { goto Cleanup;}
 
hr = pADs->get_Schema(&bstrSchema);
pADs->Release();
if(FAILED(hr)) { goto Cleanup; }
 
hr = ADsGetObject(bstrSchema, IID_IADsClass, (void**)&pCls);
if(FAILED(hr)) { goto Cleanup; }
 
VariantInit(&var);
pCls->get_MandatoryProperties(&var);
hr = printVarArray(var);
 
VariantClear(&var);
pCls->get_OptionalProperties(&var);
hr = printVarArray(var);

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

	if(pADs)
		pADs->Release();

	SysFreeString(bstrSchema);
	VariantClear(&var);
	CoUninitialize();
	return hr;

Example Code [C++]

The following code example shows how to implement the printVarArray function.

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;
}

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

IADsContainer, IADsProperty, IADsSyntax