Export (0) Print
Expand All

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

CDOEX.DLL

Syntax

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

        [C++]HRESULT GetStream
(
    _Stream** pVal
);

Parameters

pVal
Returned reference to the _Stream Interface of the object.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

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.

Example

        [C++]

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

*/
#ifndef _CORE_EXAMPLE_HEADERS_INCLUDED
#define _CORE_EXAMPLE_HEADERS_INCLUDED
#import <msado15.dll> no_namespace
#import <cdoex.dll> no_namespace
#include <iostream.h>
#endif

void IMessage_GetStream_Example() {

   IMessagePtr Msg(__uuidof(Message));

   Msg->To      = "someone@example.com";
   Msg->From    = "another@example.com";
   Msg->Subject = "This is the subject";
   Msg->AddAttachment("c:\\myimage.gif","","");
   // Save the message stream to disk.
   Msg->GetStream()->SaveToFile("c:\\message.eml", adSaveCreateOverWrite );

}
Show:
© 2014 Microsoft