BodyPart Property (IMessage)

Topic Last Modified: 2006-12-01

The IBodyPart interface on this object. This property is read-only.

Applies To

IMessage Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Property BodyPart As IBodyPart

HRESULT get_BodyPart(IBodyPart** pVal);

Parameters

Remarks

This property returns the IBodyPart interface on the object, and acts as shorthand in place of standard interface navigation such as QueryInterface or the IMessage.GetInterface method used by scripting languages.

Examples


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




/*
 You must have the following paths in your
 INCLUDE path.
 %CommonProgramFiles%\system\ado
 %CommonProgramFiles%\microsoft shared\cdo

*/
#ifndef _CORE_EXAMPLE_HEADERS_INCLUDED
#define _CORE_EXAMPLE_HEADERS_INCLUDED
#import <msado15.dll> no_namespace
#import <cdoex.dll> no_namespace
#include <iostream.h>
#endif

void IMessage_BodyPart_Example() {

   /*
   ** When using C++, avoid the interface
   ** properties and access the object's
   ** interface directly.
   */
   IBodyPart*   pBp   =   NULL;
   HRESULT hr = CoCreateInstance(
      __uuidof(Message),
      NULL,
      CLSCTX_SERVER,
      __uuidof(IBodyPart),
      (void**)&pBp);

   // ...

   pBp->Release();

}