Another Way to Bind to Formal Schema Classes and Properties

More than one way exists to bind to schema class and schema property objects. Here's an alternative approach you can use.

1 Min Read
ITPro Today logo in a gray background | ITPro Today


More than one way exists to bind to schema class and schema property objects. For example, the code in Listing A shows another approach. Here's how this code works. First, you bind to the Active Directory (AD) object. Next, you use the IADs::Schema property method to bind to the formal schema class for ADS_OBJECT. Because the AD's Schema container is the parent container of all classes, you can use the IADs::Parent method on any schema class to obtain a pointer to the schema root. You can then bind to the formal schema property definition for any property in the schema by using the IADsContainer::GetObject method to retrieve the schema property object that corresponds to the property's name. For example, if strProp were the string "sAMAccountName", the variable adsProperty would bind to that object in the schema so that you could examine its syntax and so on.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like