Supporting Message Attachments for Message Store Providers

It is not required that your message store provider support message attachments. However, many client applications expect to be able to add attachments to messages. If your message store will be used to create or store IPM.Note messages, then you should support message attachments. Default message store providers are strongly encouraged to support message attachments. For more information, see Message Classes, and Default Message Stores.

There are five types of attachments that MAPI supports: file attachments, data attachments, message attachments, OLE object attachments, and links. The requirements for supporting each type are different. Clients differentiate between the two types of attachments by means of the PR_ATTACH_METHOD property on attachment objects.

Supporting attachments means implementing the IAttach : IMAPIProp interface. The IAttach interface has no methods of its own; it only has methods inherited from the IMAPIProp interface. Since your message store provider must already implement properties for message objects, this greatly simplifies the task of supporting attachments. Implementing IAttach basically means providing a way for clients to access a table of properties for particular attachments on messages.

Data attachments are simply attachments where the contents of the attachment are stored directly in an attachment's PR_ATTACH_DATA_BIN property. Data attachments exist primarily to allow clients to attach files to a message when the sender and the recipient of the message do not have access to a common file server. See PR_ATTACH_METHOD for details.

Message attachments are attachments where the attachment subobject is another IMessage : MAPIProp object. Since message store providers already support the IMessage interface, supporting message attachments is not difficult.

Supporting OLE object attachments means implementing the OLE IStorage, IStream, and IStreamDocfile interfaces. Your message store provider must be able to convert OLE object data stored in the message into an active OLE object when a client opens the object. For more information, see Attachment Properties.

Links come in two types: links to files and links to other messages. Links to files use the ATTACH_BY_REF_ONLY value for the PR_ATTACH_METHOD property along with PR_ATTACH_PATHNAME or PR_ATTACH_LONG_PATHNAME to specify the location of a file.

How one implements links to messages may be dependent on aspects of the local messaging system, and as such cannot be fully documented here. For example, sending a link to a message that is stored on a server-based message store is typically just a matter of sending the entry identifier of the linked message, providing that both the sender and recipient have access to that server. Other messaging system configurations present other requirements and challenges for implementing links to messages.