Article ID: 199343 - Last Review: January 17, 2006 - Revision: 3.4 The basics of Exchange Client ExtensionsThis article was previously published under Q199343 On This PageSUMMARY
The purpose of this article is to answer some basic questions about Exchange Client Extensions and how they relate to Outlook.
MORE INFORMATIONWhat is a Client Extension?A Client Extension is a Dynamic-Link Library (DLL) that provides at least one Extension Object that the Client can load into its process space. These Extension Objects expose COM interfaces, which the Client then uses to call methods that can add new, customized features or that might change the Client's default behavior. Outlook calls these interfaces through the Exchange Client Extension Architecture.With the original release of the Exchange Client, Microsoft included a very capable extensibility architecture. When the Outlook Client was released, it provided support for the Exchange Client Extension Architecture so as to be compatible with existing Client Extension DLLs. The purpose of Client Extensions has from the first been to present to developers an orderly and predictable means to change the default behavior of the Exchange Client. Over several releases of Outlook, problems with that support were identified, and many were corrected. Confusion resulted when the term "Outlook Add-In" was used as a synonym for "Exchange Client Extension." Investigation has revealed that they aren't the same thing. The term "Outlook Add-In" refers to COM-based objects, which Outlook will employ for extensibility. The term does not refer to Exchange Client Extensions. It is very important to note that Outlook supports Client Extensions for backward compatibility purposes. Many companies have invested in development of Exchange Client Extensions, and Microsoft has made every effort to respect that investment. The future direction for customizing the Outlook Client will be more toward the Component Object Model (COM), and away from the DLL model when possible. However, for doing advanced menu handling and catching events in Outlook, the Client Extension will still be the preferred architecture. Therefore, in this article, "the Client" refers to both Microsoft Outlook and Microsoft Exchange Client. Why use a Client Extension?As already noted, developers use Client Extensions to change the default behavior of the Client. The advantages of an Extension include the substantial convenience provided by the Extension Architecture, and the ability to integrate customized features and new behavior directly into the Client, rather than write a separate MAPI application.Client Extensions can be used to accomplish a wide variety of messaging tasks. These can include at least the following examples:
What goes into a Client Extension?There are three basic pieces to the Client Extension. The Extension Object, the DLL file that implements it, and the registry string value. The registry value, located at the following registry keyHKEY_LOCAL_MACHINE\Software\Microsoft\Exchange\Client\Extensio
informs the Client about the Extension:
Name: Value: ----------- ---------------------------------------------- MyExtension 4.0;C:\MyExtension.dll;1;11111111111111;1111111;"MumblyTwink" To make an extension available to all mail services noted in a MAPI profile, simply omit the last entry in the registry value. The Name is used to uniquely identify this registry entry from all the others under this key. So, What's a Context? An Extension Context is simply the means used by the Client to inform an Extension about what the user is doing at the time. Each context has an associated constant name, which describes a general activity. Context Map Position Indicates ------------- ------------ --------------------------- EE_CONTEXT_SESSION 1 Logged on to MAPI EE_CONTEXT_VIEWER 2 Looking at an object(Folder, perhaps) EE_CONTEXT_REMOTEVIEWER 3 Using Remote Mail feature EE_CONTEXT_SEARCHVIEWER 4 Using Find feature EE_CONTEXT_ADDRBOOK 5 Address book is open EE_CONTEXT_SENDNOTEMESSAGE 6 Composing a Send message EE_CONTEXT_READNOTEMESSAGE 7 Reading a message EE_CONTEXT_SENDPOSTMESSAGE 8 Composing a Post message EE_CONTEXT_READPOSTMESSAGE 9 Reading a Post message EE_CONTEXT_READREPORTMESSAGE 10 Reading a delivery report, read report EE_CONTEXT_SENDRESENDMESSAGE 11 Re-sending a returned message EE_CONTEXT_PROPERTYSHEETS 12 Viewing the properties of an object EE_CONTEXT_ADVANCEDCRITERIA 13 Using Advanced Search EE_CONTEXT_TASK 14 The Client is running The context value is passed into a client extension as a parameter through Install Method interfaces exposed by an Extension object. What is an Interface? It sounds like COM. It is. An Extension Object is a COM object that inherits first from IUnknown. Therefore, it will always implement QueryInterface, AddRef, and Release. The Extension Object part happens by implementing one or more of the following interfaces: Interface Map Position ------------- ------------ IExchExtCommands 1 IExchExtUserEvents 2 IExchExtSessionEvents 3 IExchExtMessageEvents 4 IExchExtAttachedFileEvents 5 IExchExtPropertySheets 6 IExchExtAdvancedCriteria 7 IExchExt Not Mapped IExchExtModeless Not Mapped IExchExtModelessCallback Not Mapped How does the Outlook Client handle an Exchange Client Extension?The first thing the Client does before loading the Extension is to check the sixth field of the registry entry for a mail service requirement. The Client loads the DLL if the service is present in the profile, or if the field is empty. Then the Client obtains a pointer to the ExchEntryPoint function, calls it, and receives an ExchExt object pointer in return.At this point, the Client tries to load the Extension Object into every context noted in the interface map by calling the Extension's Install method. If the Install method succeeds, the Client then calls QueryInterface for each entry in the interface map, to learn what the Extension Object can do in this context. When the Client has finished loading the Extension Object, it will keep the Extension Object advised of the context changes, the current context ID, and any events that occur in that context. The notifications occur when the Client calls into the Extension Object through one of the interface pointers returned to the Client during the installation process. Very Important Note Outlook supports the Exchange Client Extension architecture for backward compatibility purposes, so there are some very particular limitations to the ability of an Extension to directly affect Outlook. For example, from an Extension, it is not possible to add menu items to the context menu that appears with a right-click in a view. To avoid this and other limitations, it is possible to use the Outlook Object Model from within a client extension. Future Knowledge Base articles will address this subject separately. Where is more information available?This article has addressed some basic questions about Exchange Client Extensions and how they relate to the Outlook Client. To learn more about Exchange Client Extensions, search for the topic "Extending the Exchange Client" in the Platform SDK documentation.REFERENCES
APPLIES TO
| Article Translations
|
Back to the top
