Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Each content BodyPart object contains a content stream that can be requested using IBodyPart.GetDecodedContentStream and IBodyPart.GetEncodedContentStream. The encoding process that is used, is defined by the urn:schemas:mailheader:Content--Transfer-Encoding property in the Fields collection. This corresponds to the Content-Transfer-Encoding mail header field defined by the MIME specification.
A body part containing the message in HTML format, within a multipart/alternative hierarchy could have the following decoded content stream:
<html><p>Here is a simple <b>message</b>.
A body part containing a binary attachment or file, such as an image or word file would contain totally different streams for the encoded and decoded content stream. For the encoded content stream, the binary stream would be encoded using a process such as base64 and returned as US-ASCII text. For the decoded stream, a raw binary stream would be returned. In addition, the ADO Stream object has a _Stream.Type property that indicates whether the content is binary or text. For text streams, the character set is identified using the _Stream.Charset property.
The content is returned in an ADO Stream object exposing an ADO _Stream interface. You can use the ADO Stream object to populate, manipulate, or examine the body part contents. Changes made to the stream can be committed back to the body part using the _Stream.Flush method. In a sense, the Stream object is bound to the body part as if the body part were its persistence location. In most cases, you use the decoded content stream to manipulate the content. For binary content, the default is the base64 encoding process.
Body parts that have content-type set to multipart do not have an associated content stream in the CDO object model. These parts exist solely to create hierarchy and relationships between child body parts. Requesting their content streams raises an exception. For example, you can request the stream (not the content stream) for these objects.