Content Class and Inheritance

Content Class and Inheritance

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

When you create a content class definition, you can inherit properties and semantics defined by other content classes. To extend or refine a content class, you specify its name in the new class's extends Field. An extended (or "derived") content class inherits both the intent of the base class and the properties of the extending content class. The concept of content class inheritance parallels that of class inheritance in programming languages such as Microsoft® Visual C++®.

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, urn:schemas-domain-tld:content-classes:salesperson, can define additional marketing properties for the contact. Rather than redefining all the properties used with the urn:content-classes:person class for the urn:schemas-domain-tld:content-classes:salesperson class, you instead inherit these properties through extension. The following illustration depicts this inheritance.

The concept art shows single inheritance, where the salesperson content class inherits the properties and content classes of the person content class.

Multiple Inheritance

A scenario that demonstrates multiple inheritance and an effective use of content classes is an expense report tailored for delivery as either an e-mail message or 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 illustration, three content classes (top row) extend the Item content class: message, expensereport, and document. They also serve as base classes for other content classes. The illustration also 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 classes share a need for expense report properties from expensereport. They do not need to have any additional property definitions.

The concept art shows multiple inheritance, where the Expensedocument content class inherits from the Expensereport and Document content classes and the expensemessage content class inherits from the Expensereport and Message content classes.

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 can define a content class that inherits from all the base classes; it depends entirely on 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 that can now understand their properties in extended content classes.

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.