MapiGetMessage Function

Action

Retrieves a message identified by the Message ID from an active MAPI Session. The returned handle can be used to access the Message properties.

When retrieving a message - attachments will be stored to temporary files, which might have some impact on the overall performance. Check the additional parameters to suppress attachements.

Inlcude file

Mapi.bdh

Syntax

MapiGetMessage( in hSession           : number, 
                in bPeekMessage       : boolean, 
                in bBodyAsAttachment  : boolean, 
                in bEnvelopeOnly      : boolean, 
                in bSupressAttachments: boolean, 
                in sMsgId             : string ) : number;
Parameter Description
hSession Valid MAPI Session Handle
bPeekMessage If true - the message is not marked as read. Some Mail Clients display read/unread messages with a different style
bBodyAsAttachment If true - the message body will be the first attachment and can be retrieved with MapiGetMessageAttachment
bEnvelopeOnly If true - only message header information is accessible. Neither attachments nor the message text is accessible. This option greatly enhances the performance.
bSuppressAttachment If true - no attachments will be retrieved. This option greatly enhances the performance as no temporary files need to be written.
sMsgId Message ID of the message that should be read. You can obtain a Message ID with MapiGetNextMsgId.

Return value

  • Message Handle if successful
  • 0 otherwise

Example

See MAPI Sample