Reading Embedded Messages

An Attachment object that represents an embedded message has a Type property of CdoEmbeddedMessage, and its Source property is a reference to the embedded Message object. Note that this is different from how the Source property is used when sending an embedded message. When sending, the Source property is set to the ID of the message to be embedded. When receiving, the Source property contains the message object itself. To retrieve the embedded message, simply assign the Source property to a Message object variable:

' CdoAttachment already Dim'ed and set.

Dim CdoInnerMessage As MAPI.Message

If CdoAttachment.Type = CdoEmbeddedMessage Then
   Set CdoInnerMessage = CdoAttachment.Source
End If

Get CDO & MAPI Programming with Visual Basic: now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.