MAPIMessages Control

               

The messaging application program interface (MAPI) controls allow you to create mail-enabled Visual Basic MAPI applications. There are two MAPI controls:

The MAPISession control signs on and establishes a MAPI session. It is also used to sign off from a MAPI session. The MAPIMessages control allows the user to perform a variety of messaging system functions.

The MAPI controls are invisible at run time. In addition, there are no events for the controls. To use them, you must specify the appropriate methods.

The MAPIMessages control performs a variety of messaging system functions after a messaging session is established with the MAPISession control.

For these controls to work, MAPI services must be present. MAPI services are provided in MAPI compliant electronic mail systems.

Note   If you attempt to run a program that uses the MAPI controls, make sure that you have the 32-bit MAPI DLLs installed properly or you may not be able to perform simple MAPI functions such as SignOn. For example, on Windows 95, you must install Mail during the operating system setup, or install it separately from the control panel to correctly use MAPI functions or MAPI custom controls from Visual Basic.

Syntax

MAPIMessages

Remarks

With the MAPIMessages control, you can:

Most of the properties of the MAPIMessages control can be categorized into four functional areas: address book, file attachment, message, and recipient properties. The file attachment, message, and recipient properties are controlled by the AttachmentIndex, MsgIndex, and RecipIndex properties, respectively.

Message Buffers

When using the MAPIMessages control, you need to keep track of two buffers, the compose buffer and the read buffer. The read buffer is made up of an indexed set of messages fetched from a user's Inbox. The MsgIndex property is used to access individual messages within this set, starting with a value of 0 for the first message and incrementing by one for each message through the end of the set.

The message set is built using the Fetch method. The set includes all messages of type FetchMsgType and is sorted as specified by the FetchSorted property. Previously read messages can be included or left out of the message set with the FetchUnreadOnly property. Messages in the read buffer can't be altered by the user, but can be copied to the compose buffer for alteration.

Messages can be created or edited in the compose buffer. The compose buffer is the active buffer when the MsgIndex property is set to -1. Many of the messaging actions are valid only within the compose buffer, such as sending messages, sending messages with a dialog box, saving messages, or deleting recipients and attachments.

Refer to the object library in the Object Browser for property and error constants for the control.