Platform SDK: CDO for Windows 2000

BodyPart Property

The BodyPart property specifies the IBodyPart interface on this object.

[Visual Basic]
Property BodyPart as IBodyPart
read-only
[C++]
HRESULT get_BodyPart(IBodyPart** pVal);
[IDL]
HRESULT [propget] BodyPart([out,retval] IBodyPart** pVal);

Remarks

This property returns the IBodyPart interface on the object, and acts as a replacement for standard interface navigation mechanisms such as QueryInterface.

Example

[Visual Basic]
' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iMsg as New CDO.Message 
Dim iBp as CDO.IBodyPart ' for IBodyPart on message 

   'Get IBodyPart using BodyPart property
Set iBp = iMsg.BodyPart

Set iBp = Nothing ' Release
   ' Get IBodyPart using QI 
Set iBp = iMsg

Set iBp = Nothing ' Release
[C++,IDL]
#include "cdosys.h"
#include "cdosys_i.c"
void main(){
  CoInitialize(NULL);
  IMessage* pMsg = NULL;
  CoCreateInstance(CLSID_Message,
                   NULL,
                   CLSCTX_INPROC_SERVER,
                   IID_IMessage,
                   reinterpret_cast<void**>(&pMsg));
  IBodyPart* pBp = NULL;

  // Get IBodyPart using the property  
  pMsg->get_BodyPart(&Bp);
  pBp->Release();
  // Get IBodyPart using QI
  pMsg->QueryInterface(IID_IBodyPart,
                      reinterpret_cast<void**>(&pBp));
  pBp->Release();
  pMsg->Release();
   // ... 
  CoUninitialize();
 }