The IDataSource COM Interface
You can use the IDataSource interface to access message data in other objects. Using the IDataSource interface, you can:
- Embed one message into another message's body part hierarchy or save the message in serialized format into an object that exposes either the _Stream or IStream interface.
- Extract a message from another message's body part hierarchy or load a serialized message stored in an object that exposes either the _Stream or IStream interface.
The following scenarios illustrate common uses of the IDataSource interface on a Message object:
- Embed message A into message B as an attachment. MIME defines the message content type to identify embedded messages. If the entire message is embedded in the body part, the full content type is normally set to message/rfc822. You can use the IDataSource.SaveToObject method to embed a message into another within a particular body part.
- Extract a message contained as a body part within another Message object. Such embedded messages are contained within body parts normally marked with the message/rfc822 content-type. You can use the IDataSource.OpenObject method to extract the message.
- Save message A into an ADO Stream object for transport into a database or to the file system. The message is serialized using the format indicated by the IMessage.MimeFormatted property and then written into the object.
- Open a serialized message within an ADO Stream object into a Message object. When the message is opened, the serial format is parsed, and the appropriate object model is generated.
- Perform the same operations described in the previous two bullet points with objects exposing the IStream interface. Such objects include those generated by OLE DB providers.