Platform SDK: CDO for Windows 2000 |
The GetStream method returns a Microsoft® Active X® Data Objects (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);
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) ////////////////////////////////