| Platform SDK: CDO for Windows 2000 |
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 one 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 Multipurpose Internet Mail Extensions (MIME) hierarchy as a body part with Content-Type message/rfc822.
To embed one message into another, perform the following steps:
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 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 <cdosys.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, iBp)
Dim iDsrc
Set iDsrc = iMsg.DataSource
iDsrc.SaveToObject iBp, "IBodyPart"
End Sub