Platform SDK: Exchange 2000 Server

Content Class Inheritance

[This is preliminary documentation and subject to change.]

When you create a content class definition, you can inherit properties specified for other content classes by using the urn:schemas-microsoft-com:xml-data#extends property.

An extended, or derived, content class contains the properties of the extending content class plus any new properties you add. The concept of content class inheritance parallels class inheritances in programming language such as C++.

The following snippet sets the extends property by using an ADO Record object named Rec:

Rec.Fields.Item("urn:schemas-microsoft-com:xml-data#extends").Value = _
      Array("urn:content-classes:item")

In this case, the content class being defined extends the urn:content-classes:item content class, a generic content class. The extends property is multi-valued, so you can create a content-class definition that extends multiple content classes.

Single Inheritance

An example of single inheritance is extending the urn:content-classes:person content class for a contact management application. Your new content class, such as salesperson, could have additional marketing properties for the contact and you would inherit a comprehensive set of core contact properties to use. The following figure depicts single inheritance.

Multiple Inheritance

A scenario that demonstrates multiple inheritance, and an effective use of content classes, is an expense report tailored for delivery as a message or as a document. To create an application for electronically mailing expense reports, you need access to expense report and message properties; for applications generating expense-report documents, you need access to expense report and document properties.

In the following figure, three content classes (top row) extend the Item content class: message, expensereport, and document. They also serve as base classes to other content classes. It shows two derived content classes (bottom row): expensemessage and expensedocument. These content classes need properties from their base classes: message and document, respectively. And both share a need for expense-report properties from expensereport. They do not need to have any additional property definitions.

The e-mail expense-report application will use the expensemessage content class, and the document expense-report application will use the expensedocument content class. Of course, you could define a content class that inherits from all the base classes; it’s entirely up to the needs of the application.

The benefits of inheritance are not only for applications designed for a newer, derived content class, but also for any older applications can now understand their properties in extended content classes.