The IExchExtMessageEvents interface is implemented by extension objects and gives them the ability to replace or enhance the default message-handling behavior of Microsoft Exchange. Microsoft Exchange always calls these methods in pairs. For example, if it calls the IExchExtMessageEvents::OnRead method, it also calls the IExchExtMessageEvents::OnReadComplete method; if it calls the IExchExtMessageEvents::OnWrite method, it also calls the IExchExtMessageEvents::OnWriteComplete method, and so forth. The OnReadComplete, OnWriteComplete, IExchExtMessageEvents::OnSubmitComplete, and IExchExtMessageEvents::OnCheckNamesComplete methods are used to undo operations whenever an error occurs. They are also used to release resources that are allocated during calls to the OnRead, OnWrite, IExchExtMessageEvents::OnSubmit, and IExchExtMessageEvents::OnCheckNames methods. For example, an extension object can allocate buffers to validate text during a call to the OnRead method, and deallocate these buffers during a call to the OnReadComplete method.
There is a specific set of steps followed by Microsoft Exhange to handle errors during a call to these functions. This is best illustrated with a specific example that applies to all other methods in this interface. Suppose Microsoft Exchange calls OnCheckNames to notify extensions that it is about to check names and give extensions an opportunity to resolve names. If no extensions return S_OK, Microsoft Exchange performs the name resolution itself. After the resolution is completed or if it failed, Microsoft Exchange calls the OnCheckNamesComplete method of all the extensions whose OnCheckNames method it called, passing in EEME_FAILED if the operation failed. If any extension returns an error from OnCheckNamesComplete, Microsoft Exchange calls each of those extensions again, passing in EEME_COMPLETE_FAILED as the value for the ulFlags parameter. The same series of steps applies to other methods in this interface.
IExchExtMessageEvents is used only in the following contexts:
EECONTEXT_SENDNOTEMESSAGE
EECONTEXT_READNOTEMESSAGE
EECONTEXT_SENDPOSTMESSAGE
EECONTEXT_READPOSTMESSAGE
EECONTEXT_READREPORTMESSAGE
EECONTEXT_SENDRESENDMESSAGE
This interface is optional.
Header file: | EXCHEXT.H |
Exposed by: | Extension objects |
Implemented by: | Extension objects |
Called by: | Microsoft Exchange |
Corresponding pointer type: | LPEXCHEXTMESSAGEEVENTS |
OnRead | Replaces or enhances the behavior of Microsoft Exchange when reading information from a message. |
OnReadComplete | Enables extension objects to roll back their implementation of the OnRead method in case of an error or to release resources allocated by OnRead. |
OnWrite | Replaces or enhances the behavior of Microsoft Exchange when writing information to a message. |
OnWriteComplete | Enables extension objects to roll back their implementation of the OnWrite method in case of an error or to release resources allocated by OnWrite. |
OnCheckNames | Replaces or enhances the behavior of Microsoft Exchange when recipient names typed by the user are being resolved to their address book entries. |
OnCheckNamesComplete | Enables extension objects to roll back their implementation of the OnCheckNames method in case of an error or to release resources allocated by OnCheckNames. |
OnSubmit | Replaces or enhances the behavior of Microsoft Exchange when a message has been submitted. |
OnSubmitComplete | Enables extension objects to roll back their implementation of the OnSubmit method in case of an error or to release resources allocated by OnSubmit. |