Click to Rate and Give Feedback
MSDN
MSDN Library
Reference
Interfaces
IBodyPart Interface
 GetStream Method
Collapse All/Expand All Collapse All
Exchange Server 2003
GetStream Method

Topic Last Modified: 2004-06-08

The GetStream method returns a Microsoft® Active X® Data Objects (ADO) Stream object reference containing the headers and content of this body part.

Function GetStream() as ADODB.StreamHRESULT GetStream(_Stream** pVal);
pVal

On successful return, a reference to an ADO Stream object.

The GetStream method returns a copy of the entire body part, including its headers, content, and all subparts, in serialized (transport) form within a single Stream object. To obtain a stream containing just the body part contents, use the GetDecodedContentStream method or the GetEncodedContentStream method.

Calling the GetStream method returns a copy of the contents of this BodyPart object in the returned Stream object. If you modify the content in the returned Stream object and you want to update the location that you retrieved the stream from, you must commit the changes back by calling the Flush (_Stream.Flush) method.

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.GetStream

' this stream has mail headers and the content
' in encoded format for the report.doc attachment
  

The AddAttachment method sets up standard header fields automatically. The stream contents could look something like the following:

Content-Type: application/msword;
        name="report.doc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
        filename="report.doc"

0M8R4KGxGuEAAAAAA....(etc)
////////////////////////////////

  
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker