大网数据广告活动
域与目录服务

Reading the Abstract Schema

· 52CE 我爱测

This topic provides a code example and guidelines for reading from the abstract schema, which provides a subset of the data stored in the attributeSchema and classSchema objects in the schema container.

This topic provides a code example and guidelines for reading from the abstract schema, which provides a subset of the data stored in the attributeSchema and classSchema objects in the schema container. To retrieve data that is unavailable in the abstract schema, read the data directly from the schema container as described in Reading attributeSchema and classSchema Objects.

Use the "LDAP://schema" binding string to bind to an IADsContainer pointer on the abstract schema. Use this pointer to enumerate the class, attribute, and syntax entries in the abstract schema. You can also use the IADsContainer.GetObject method to retrieve individual entries.

// Bind to the abstract schema.
IADsContainer *pAbsSchema = NULL;
hr = ADsGetObject(L"LDAP://schema",
                  IID_IADsContainer,
                  (void**)&pAbsSchema);
' Bind to the abstract schema.
Dim adschema As IADsContainer
Set adschema = GetObject("LDAP://schema")

Use a similar binding string, "LDAP://schema/<object>", to bind directly to a class or attribute entry in the abstract schema. In this string, "<object>" is the lDAPDisplayName of a class or attribute. For classes bind to the IADsClass interface; for attributes, bind to IADsProperty interface.

// Bind to the user class entry in the abstract schema.
IADsClass *pClass;
hr = ADsGetObject(L"LDAP://schema/user",
                  IID_IADsClass,
                  (void**)&pClass);
Bind to the user class entry in the abstract schema.
Dim userclass As IADsClass
Set userclass = GetObject("LDAP://schema/user")

In addition, the IADs interface provides the IADs.Schema property. This property returns the ADsPath for the object class in abstract schema binding string format. If you have an IADs pointer to an object, you can bind to its class in the abstract schema using the ADsPath returned from IADs.Schema.

For classes, the following table lists key properties provided by the abstract schema.

Property Meaning
IADsClass.Abstract Indicates whether this is an abstract class.
IADsClass.Auxiliary Indicates whether this is an auxiliary class.
IADsClass.AuxDerivedFrom Array of auxiliary classes this class derives from.
IADsClass.Container Indicates whether objects of this class can contain other objects, which is true if any class includes this class in its list of possibleSuperiors.
IADsClass.DerivedFrom Array of classes that this class is derived from.
IADsClass.MandatoryProperties Retrieves an array of the mandatory properties that must be set for an instance of the class. The returned list includes all the mustContain and systemMustContain values for the class and the classes from which it is derived, including superclasses and auxiliary classes.
IADsClass.OID Retrieves the governsID of the class.
IADsClass.OptionalProperties Retrieves an array of the optional properties that might be set for an instance of the class. The returned list includes all the mayContain and systemMayContain values for the class and the classes from which it is derived, including superclasses and auxiliary classes.
IADsClass.PossibleSuperiors Retrieves an array of the possibleSuperiors values for the class, which indicates the object classes that can contain objects of this class.

The abstract schema is stored in the subSchema object in the schema container. To get the distinguished name of the subSchema object, bind to rootDSE and read the subSchemaSubEntry attribute, as described in Serverless Binding and RootDSE. Be aware that it is more efficient to read the abstract schema by binding to "LDAP://schema", than by binding directly to the subSchema object.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。