Miscellanea

The MAPI controls provide some helper methods that you don’t strictly need but may find convenient when implementing certain common tasks. These are the Forward, Reply, ReplyAll, and Copy methods of the MAPIMessages control. These methods all copy the currently indexed message to the compose buffer, setting the MsgIndex property to -1. The Reply and ReplyAll methods set the recipient list appropriately and also add “RE:” to the beginning of the subject text. The Forward method clears the recipient list and adds “FW:” to the beginning of the subject text. The Copy method simply copies all properties over to the compose buffer. These methods do nothing to the message body, so if you want neat effects such as indenting the original message, you’ll have to do it programmatically.

The MAPIMessages control has a method called Save, which copies the message currently in the compose buffer to the Inbox. One way to use this is to allow the user to quit the application while in the middle of composing a message. The application could later resume by locating the message in the Inbox and calling the MAPIMessages control’s Copy method to copy the message back to the compose buffer. The Copy method doesn’t delete the message from the Inbox, so after sending the composed message, the application would need to go back to the Inbox, find the previously saved message, and delete it.

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.