IExchExtAttachedFileEvents::OnOpenPatt

Replaces or enhances the behavior of Microsoft Exchange when opening a document file attachment directly from a message.

Quick Info

See IExchExtAttachedFileEvents : IUnknown.

HRESULT OnOpenPatt(
  LPATTACH lpAtt  
);
 

Parameters

lpAtt
[in] Pointer to the MAPI IAttach : IMAPIProp interface on the attachment.

Return Values

S_OK
The extension object replaced Microsoft Exchange behavior and opened the file on its own. Microsoft Exchange will consider the task handled.
S_FALSE
The extension object did nothing or added additional behavior. Microsoft Exchange will continue to call extensions or complete the work itself.

Remarks

Microsoft Exchange calls the IExchExtAttachedFileEvents::OnOpenPatt method when it is about to open an attachment directly from the message. Before writing it to an intermediate file, Microsoft Exchange allows extension objects to open directly from the attachment. File viewers might use this method to display the content of the attachment without writing an intermediate file to the file system.

Microsoft Exchange attempts to find an application that is registered to handle the attached file's class. If no such application can be found, Microsoft Exchange writes the attachment to a temporary file and prompts Microsoft® Windows® operating system to start the application that is registered to handle files with the given file extension (such as .XLS for Microsoft Excel).

It then calls the IExchExtAttachedFileEvents::OnOpenSzFile method on extension objects instantiated in the context that supports the IExchExtAttachedFileEvents : IUnknown interface. Microsoft Exchange may try to open an attachment from a file after learning from IExchExtAttachedFileEvents::QueryDisallowOpenPatt that it is allowed to do so. At this point, Microsoft Exchange prompts the extension object if it wants to do special handling of the file, such as replacing the open-attachment behavior or by doing other work such as detecting viruses.

If an error occurs, OnOpenPatt should display an error message and return an error. Microsoft Exchange will not continue to try and open the attachment, nor will it display an error message, but will stop the user action that requested the attachment be opened.