Platform SDK: Exchange 2000 Server

GetStream Method

[This is preliminary documentation and subject to change.]

Returns an ADO Stream object reference containing the headers and content of this body part.

[Visual Basic]
Function GetStream() as ADODB.Stream
[C++]
HRESULT GetStream(_Stream** pVal);
[IDL]
HRESULT GetStream([out,retval] _Stream** pVal);

Remarks

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 either GetDecodedContentStream or GetEncodedContentStream.

Calling GetStream 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 wish to then update the location from whence you retrieved the stream, you must commit the changes back by calling the Flush (_Stream.Flush) method.

Example

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 sets up standard header fields automatically. The stream contents could look something like

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

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

  

See Also

Bodypart Fields and Streams