GetStream Method
The document is archived and information here might be outdated

GetStream Method

Exchange Server 2003

GetStream Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The GetStream method returns this message in serialized (wire-transport) format in a Microsoft ActiveX Data Objects (ADO) Stream object.

Applies To

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In



        [Visual Basic]Function GetStream
() As ADODB.Stream

        [C++]HRESULT GetStream
    _Stream** pVal


Returned reference to the _Stream Interface of the object.

Return Value

Returns S_OK if successful, or an error value otherwise.


The GetStream method returns the entire message, including its headers and content (all body parts if Multipurpose Internet Mail Extensions (MIME) formatted) as a serialized stream within a single ADO Stream object. To obtain a stream for one of a message's body parts, call that body part object's GetDecodedContentStream or GetEncodedContentStream method.

The stream returned by this method is essentially a serialized copy of the current message, as it existed when this method was invoked. All changes made to the Stream object are local, and the message itself is not updated until the stream is flushed back by calling the Flush method on the ADO Stream object.



 You must have the following paths in your
 INCLUDE path.
 %CommonProgramFiles%\microsoft shared\cdo

#import <msado15.dll> no_namespace
#import <cdoex.dll> no_namespace
#include <iostream.h>

void IMessage_GetStream_Example() {

   IMessagePtr Msg(__uuidof(Message));

   Msg->To      = "";
   Msg->From    = "";
   Msg->Subject = "This is the subject";
   // Save the message stream to disk.
   Msg->GetStream()->SaveToFile("c:\\message.eml", adSaveCreateOverWrite );

© 2016 Microsoft