GetDecodedContentStream Method
Topic Last Modified: 2006-06-13
Returns the Microsoft® ActiveX® Data Objects (ADO) Stream object containing the body part content in decoded format.
Applies To
Type Library
Microsoft CDO for Exchange 2000 Library
DLL Implemented In
CDOEX.DLL
Syntax
Function GetDecodedContentStream() As ADODB.Stream
HRESULT GetDecodedContentStream
(
_Stream** pVal
);
Parameters
- pVal
Returned reference to a _Stream object.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
CDO uses the current value of the ContentTransferEncoding property and the MIMEFormatted property to determine which encoding mechanism to use to decode or encode the contents of the implementing object. It is the programmer's responsibility to have the appropriate value set in ContentTransferEncoding.
The Stream object returned contains a read/write copy of the current (decoded) 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 GetDecodedContentStream method returns an error if called on an object that has Content-Type set to "multipart".
To obtain the encoded content, use the GetEncodedContentStream Method.
Example
Dim iMsg As New CDO.Message
Dim iBp As CDO.IBodyPart
Set iBp = iMsg.BodyPart.AddBodyPart
Dim Strm As ADODB.Stream
Set Strm = iBp.GetDecodedContentStream
Strm.WriteText "This is some text for the body part"
Strm.Flush
' Add more body parts, etc.
'...
iMsg.Send
Strm.Close
Set Strm = Nothing
See Also
Other Resources
CDO BodyPart Fields and Streams
Saving Messages into ADO Stream Objects
GetEncodedContentStream Method