共用方式為


PreprocessMessage

Applies to: Office 2010 | Outlook 2010 | Visual Studio

Defines a function that preprocesses message contents or the format of a message.

Header file:

Mapispi.h

Defined function implemented by:

Transport providers

Defined function called by:

MAPI spooler

HRESULT PreprocessMessage(
  LPVOID lpvSession,
  LPMESSAGE lpMessage,
  LPADRBOOK lpAdrBook,
  LPMAPIFOLDER lpFolder,
  LPALLOCATEBUFFER AllocateBuffer,
  LPALLOCATEMORE AllocateMore,
  LPFREEBUFFER FreeBuffer,
  ULONG FAR * lpcOutbound,
  LPMESSAGE FAR * FAR * lpppMessage,
  LPADRLIST FAR * lppRecipList
);

Parameters

  • lpvSession
    [in] Pointer to the session to be used.

  • lpMessage
    [in] Pointer to the message to be preprocessed.

  • lpAdrBook
    [in] Pointer to the address book from which the user should select recipients for the message.

  • lpFolder
    [in, out] Pointer to a folder. On input, the lpFolder parameter points to the folder that contains messages to be preprocessed. On output, lpFolder points to the folder where preprocessed messages have been placed.

  • lpAllocateBuffer
    [in] Pointer to the MAPIAllocateBuffer function, to be used to allocate memory.

  • lpAllocateMore
    [in] Pointer to the MAPIAllocateMore function, to be used to allocate additional memory where required.

  • lpFreeBuffer
    [in] Pointer to the MAPIFreeBuffer function, to be used to free memory.

  • lpcOutbound
    [out] Pointer to the number of messages in the array pointed to by the lpppMessage parameter.

  • lpppMessage
    [out] Pointer to a pointer to an array of pointers to preprocessed or otherwise generated messages.

  • lppRecipList
    [out] Pointer to an optional returned ADRLIST structure, listing preprocessor-detected recipients for which the message is undeliverable. For more information about the contents of this list, see the IMAPISupport::StatusRecips method.

Return Value

  • S_OK
    Message contents were successfully preprocessed.

Remarks

A transport-provider message preprocessor can present a progress indicator during message preprocessing. However, it should never present a dialog box requiring user interaction during message preprocessing.

When a preprocessor adds large amounts of data to an outbound message, certain procedures should be followed. This type of message can be stored in a server-based message store, causing the preprocessor to access a remote store, a time-consuming procedure. To avoid having to do so, the preprocessor should have an option that enables it to store data that takes a large amount of space in a local message store and to provide a reference to that local store in the message.

The preprocessor should not release any of the objects originally passed to the PreprocessMessage based function.

Before the MAPI spooler can call a PreprocessMessage function, the transport provider must have registered the function in a call to the IMAPISupport::RegisterPreprocessor method. After calling a PreprocessMessage function, the spooler cannot continue submitting a message until the function returns.

The MAPI spooler owns the task of submitting messages. This means the original message is never placed in an array of message pointers and that a call to the SubmitMessage methods is never required.

See Also

Reference

IAddrBook : IMAPIProp

IMAPIFolder : IMAPIContainer

IMAPISupport : IUnknown