| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
You can use the IDataSource.SaveToObject method to "copy" an entire Message object into another Message object. This is most useful when you want to embed the message into another as a body part. If you embed Message A into Message B, Message B would then contain message A in its entirety within its MIME hierarchy as a body part with Content-Type "message/rfc822."
To embed a message into another, perform the following steps:
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Exchange 2000 Server Library
' ..
Sub EmbedMessage(iMsg As CDO.Message, iBp As IBodyPart)
Dim iDsrc As IDataSource
Set iDsrc = iMsg
iDsrc.SaveToObject iBp, "IBodyPart"
End Sub
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace
#import "c:\exchsrvr\cdoex.dll" no_namespace
// ...
void EmbedMessage( IMessagePtr iMsg, IBodyPartPtr iBp)
{
IDataSourcePtr iDsrc;
iDsrc = iMsg;
try
{
iDsrc->SaveToObject(iBp,_bstr_t("IBodyPart"));
}
catch(_com_error error)
{
throw error;
}
}
Sub EmbedMessage(iMsg As CDO.Message, iBp As IBodyPart)
Dim iDsrc
Set iDsrc = iMsg.DataSource
iDsrc.SaveToObject iBp, "IBodyPart"
End Sub