MAPI Architecture

MAPI Messaging Subsystem

CMC, Simple MAPI, and Extended MAPI provide the required API calls for messaging applications. These calls work with a second level of MAPI features called the messaging subsystem. The messaging subsystem, which is part of the computer's operating system, responds to the API calls and performs the requested actions. It is called a subsystem because it is a subset of the entire operating system.

click to view at full size.

Figure 11.1 How MAPI is used to create messaging-enabled applications

The MAPI messaging subsystem divides tasks related to handling multiple transport service providers. Drivers for each transport (in the form of a Windows DLL) provide the interface between the MAPI messaging subsystem and the back-end messaging system called the Service Provider Interface (SPI).

Service Provider Interfaces (SPIs)

The third level of MAPI features is the use of a back-end architecture to provide messaging-system independence for applications. MAPI-compliant messaging applications can communicate with any messaging service as long as the necessary drivers are installed. This concept is similar to printing to many different printers using the appropriate printer drivers.

Advantages of Using MAPI

MAPI's open architecture allows information from a variety of services, such as fax, bulletin boards , and e-mail, to be used easily with any MAPI client application. In Windows, users can select the service provider drivers for the desired back-end services.

Because of these drivers, client applications can work with multiple messaging systems, such as Microsoft Mail, Novell MHS, and IBM PROFS, at the same time without being customized for each system.

Using MAPI with Microsoft Visual Basic

MAPI controls allow you to create mail-enabled Visual Basic MAPI applications. There are two MAPI controls:

  • MAPISession
  • MAPIMessages
The MAPISession control signs on and establishes a MAPI session. It is also used to sign off from a MAPI session.

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

Example

This example opens an e-mail message in Visual Basic using the MAPISession and
  MAPIMessages  controls: 

Private Sub GetLastMessage_Click() Dim strHeader As String 'Log on, set the message session, and fetch mail. MAPISession1.Action = mapSignOn MAPIMessages1.SessionID = MAPISession1.SessionID MAPIMessages1.Fetch 'set message index to the last 'email message in the Inbox. MAPIMessages1.MsgIndex = MAPIMessages1.MsgCount - 1 strHeader = "FROM: " & MAPIMessages1.MsgOrigDisplayName strHeader = strHeader & " SUBJECT: " & _ MAPIMessages1.MsgSubject 'Display a message box to display the message 'content, and log off. MsgBox MAPIMessages1.MsgNoteText, , strHeader MAPISession1.Action = mapSignOff End Sub


Note

For more information, go to Microsoft's MAPI Web site (www.microsoft.com/win32dev/mapi/).




Microsoft Windows Architecture Training
Microsoft Windows Architecture for Developers Training Kit
ISBN: B00007FY9D
EAN: N/A
Year: 1998
Pages: 324

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net