Messaging Application Development
MAPI is a COM-based library that provides programmatic access to the Microsoft messaging client application, Messaging (formerly named Inbox), as well as to message stores and the message items they contain.
You can also use MAPI to create an entirely new messaging client application, create a new messaging transport, create custom forms for the Messaging application, implement a mail-rule client to programmatically process incoming messages, implement an advise-sink object for handling notifications, and programmatically manage high-level operations on container objects like address books, distribution lists, and folders.
|Prior to the release of Pocket PC 2002 and Smartphone 2002 software, programmatic access to the messaging system was provided through the Windows Embedded CE MsgStore APIs (found in msgstore.h and msgstore.lib). Although later versions of Windows Mobile provide limited backward compatibility, it is recommended that you modify your code to use MAPI instead.|
For background information on the messaging subsystem, and on extending the Messaging application, see the following topics in this section:
- Customized Messaging Rules Clients
A customized messaging rules client is a message processor that works in conjunction with the Messaging application (or any other messaging client application). When a message arrives at a particular message store, the messaging rules client checks to see whether it meets a set of criteria (defined by the messaging rules client). If it does, the client moves the message to a destination folder, modifies it, or deletes it. For example, a messaging rules client can delete incoming messages that are sent from a list of blocked senders.
- Hyperlinking in Messages
The Windows Mobile Messaging application recognizes web address and other URI monikers in SMS and e-mail messages and automatically presents them to users as clickable hyperlinks in the read form. It is a feature called Smart Hyperlinking, and it provides users with the convenience of being able to act on message content to open web pages, open files, begin e-mail and SMS message composition, and place telephone calls.
- Message Stores
A message store serves as a local archive for storing messages on Windows® phones. One message store is present for each messaging account, and each messaging account is associated with one message transport. For example, you might use a Windows phone to service three POP3 e-mail accounts. In this scenario, you might have four message stores: one for Outlook e-mail transferred through ActiveSync, two for Outlook e-mail transferred via POP3, and one for text messages transferred via Short Message Service (SMS).
- Messaging Forms
You can change the behavior of the Messaging application (or any other messaging client application) by creating customized messaging forms. They are customized read and compose forms and can be used with new and existing transports. The behavior that they provide can vary, from adding new transport types such as Multimedia Messaging Service (MMS) to adding a new message type, such as one that supports playing a game like ticktacktoe.
- Messaging Transports
A message transport is a networking protocol that facilitates the transfer of messages between a messaging client application and a messaging host server.
- SMS Messaging
The Messaging Application treats SMS messages just like e-mail messages—receiving them in a separate messaging account. All GSM codes are supported, including the ability to replace old SMS messages with new ones. Long SMS messages are parsed appropriately into several messages sent in succession to the recipient SMS user. SMS messages can be forwarded, replied to, created, and saved, just like e-mail.
- Over the Air Provisioning with SI and SL Messages
SI and SL messages are part of a WAP Push mechanism that mobile operators can use to provision files over the air (OTA) to Windows Mobile devices.
- Pocket Outlook Object Model (POOM)
POOM is a COM-based library that provides programmatic access to Outlook Mobile data items. It provides an object-oriented framework for creating, modifying, and displaying appointment, task, and contact items—and for manipulating the folders that contain them. Note: Outlook Mobile uses the messaging subsystem to send meeting requests, and to assign tasks to recipients.
- Beginning a MAPI Session
Before you can access a message store, you must initialize the MAPI subsystem and log onto a MAPI session. This gives you a reference to an IMAPISession interface object, which you can use to access the message store table, message stores, message folders, and messages.
- Creating a Message
New messages are created from a message store's Drafts folder. After you create a message, you can set its property values (subject, body, list of recipients, and so on) and then send the message.
- Registering Customized Messaging Forms
Customized messaging forms require two separate registry entries. The first entry registers the form COM server as a message class. This gives the Messaging application the information it needs to locate the plug-in DLL, and extract the Read and Compose forms for displaying and creating messages. The second entry specifies the messaging transports to use.
- Registering Customized Messaging Rules Clients
Customized messaging rules clients require two separate registry entries. The first entry registers the messaging rules client as a COM server, specifying its GUID. The second entry specifies the message transports to use.
- Registering Customized Messaging Transports
Customized messaging transports require one registry entry that specifies the name for the new message transport, along with the name of the DLL that implements it.
- Over the Air Provisioning with SI and SL Messages
The user can use the mobile Internet browser to download the provisioning file that contains an update. The user can be notified that a download is available through SMS, an e-mail message, or a service indication (SI). The user can then browse to a Web site to retrieve available downloads.