Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Returns an ADO Stream object containing the body part content in encoded format.
[Visual Basic] Function GetEncodedContentStream() as ADODB.Stream [C++] HRESULT GetEncodedContentStream(_Stream** pVal); [IDL] HRESULT GetEncodedContentStream([out,retval] _Stream** pVal);
CDO uses the current value of the ContentTransferEncoding property and the IMessage.MIMEFormatted property to determine which encoding mechanism to use to decode or encode body part contents. If the message is to be MIME-formatted, then the encoding set in ContentTransferEncoding is used to encode the contents. Although CDO provides standard defaults for ContentTransferEncoding, it is the programmer's responsibility to have the appropriate value set before calling GetEncodedContentStream.
The Stream object returned contains a read/write copy of the current (encoded) contents of the object implementing IBodyPart. If you modify the contents within the returned Stream object, you must call the Flush method to commit the changes back into the object.
The GetEncodedContentStream method return an error if called on a multipart body part as these body parts have no content, and simply act as structure units in the MIME hierarchy.
To obtain the content in its decoded form, use the GetDecodedContentStream method.
' This is a manual way to copy an attachment Dim iMsg as New CDO.Message Dim iBp as CDO.IBodyPart Set iBp = iMsg.AddAttachment("c:\report.doc") Dim Stm as ADODB.Stream Set Stm = iBp.GetEncodedContentStream Dim iMsg2 as new CDO.Message Dim iBp2 as CDO.IBodyPart Dim Flds as ADODB.Fields Set iBp2 = iMsg2.BodyPart.AddBodyPart Set Flds = iBp2.Fields Flds("urn:schemas:mailheader:content-disposition") = "attachment" Flds("urn:schemas:mailheader:content-transfer-encoding") = "base64" Flds.Update Dim Stm2 as ADODB.Stream Set Stm2 = iBp2.GetEncodedContentStream Stm .CopyTo Stm2 Stm2.Flush ' go on to send messages