Hello Gerry,
Based on my understanding, the problem is: You are writing contents of one
message to a disk file in IExStoreAsyncEvents.OnSave function. However,
this stream.SaveToFile function doesn't write anything. Right?
Generally speaking, to save a serialized message from a Message object into
a Microsoft? ActiveX? Data Objects (ADO) Stream object, perform the
following steps:
1) Retrieve the IDataSource interface on the Message object.
2) Create or otherwise obtain a _Stream object reference on an ADO Stream
object.
3) Using the IDataSource interface on the Message object, call the
SaveToObject method, passing the _Stream object reference as the first
argument, and the string "_Stream" as the second
The sample VB code likes:
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Sub SaveMessageToFile(iMsg As CDO.Message, Filepath As String)
Dim Stm As New Stream
Stm.Open
Stm.Type = adTypeText
Stm.Charset = "US-ASCII"
Dim iDsrc As IDataSource
Set iDsrc = iMsg
iDsrc.SaveToObject Stm, "_Stream"
Stm.SaveToFile Filepath, adSaveCreateOverWrite
End Sub
For details, please refer to "Saving Messages into ADO Stream Objects"
topic in MSDN. Please search the topic and select "search in titles only"
to get that.
Also, you can refer to
http://msdn.microsoft.com/library/en...atasource_inte
rface.asp?frame=true for some demo code.
In Internet, we can also find a sample at
http://www.codeproject.com/csharp/Cs...SinksHooks.asp. However, it
is somewhat different since the author uses FileStream to save some content
to a file.
Please test the above and let me know whether it works. If there is any
questions, please feel free to let me know.
Thanks very much.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ¨C
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.