Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
Use the IDataSource.OpenObject method to extract messages contained within other objects, such as Message or BodyPart objects, and move them into another Message object. This method is most useful when you wish to extract an embedded message from within some other Message object's BodyPart hierarchy. The process is analogous to opening files in Microsoft® Word: the content in the opened file is copied from the disk into the running application. Embedded messages in other messages are contained in body parts with Content-Media-Type set to "message." When you encounter such a message in a body part, you can open it in the following way:
' Reference to Microsoft ActiveX Data Objects 2.5 Library ' Reference to Microsoft CDO for Exchange 2000 Server Library ' .. Function ExtractMessage(iBp As IBodyPart) As Message Dim iMsg As New CDO.Message Dim iDsrc As IDataSource Set iDsrc = iMsg iDsrc.OpenObject iBp, "IBodyPart" Set ExtractMessage = iMsg End Function
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace #import "c:\exchsrvr\cdoex.dll" no_namespace // ... IMessagePtr ExtractMessage(IBodyPartPtr iBp) { IMessagePtr iMsg(__uuidof(Message)); IDataSourcePtr iDsrc; iDsrc = iMsg; try { iDsrc->OpenObject(iBp,_bstr_t("IBodyPart")); } catch(_com_error error) { throw error; } return iMsg; }
Function ExtractMessage(iBp As IBodyPart) As Message Dim iMsg Set iMsg = CreateObject("CDO.Message") Dim iDsrc Set iDsrc = iMsg.DataSource iDsrc.OpenObject iBp, "IBodyPart" Set ExtractMessage = iMsg End Function