GetStream Method
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.
Returns the Microsoft ActiveX Data Objects (ADO) Stream object reference containing the headers and content of this body part.
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 a _Stream object.
Return Value
Returns S_OK if successful, or an error value otherwise.
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 then want to update the location from which you retrieved the stream, you must commit the changes back by calling the Flush (_Stream.Flush) method.
Examples
[Visual Basic]
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.
' Clean up. Stm.Close Set Stm = Nothing
The AddAttachment method 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) ////////////////////////////////
</pre>
See Also
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.