Partager via


TextBody Property (IMessage)

Topic Last Modified: 2006-12-01

The plain text representation of the body of this message.

Applies To

IMessage Interface

Type Library

Microsoft CDO for Exchange 2000 Library

DLL Implemented In

CDOEX.DLL

Syntax

Property TextBody As String

HRESULT get_TextBody(BSTR* pVal);HRESULT put_TextBody(BSTR Val);

Parameters

  • pVal
    Returns the value of the TextBody property as a reference to a BSTR.
  • Val
    Sets the value of the TextBody property to the value of the BSTR.

Remarks

This property is also available as the textdescription Field in the schema.

To construct a Multipurpose Internet Mail Extensions (MIME) message containing both the plain text and HTML versions of the body, you can set the message's IBodyPart ContentMediaType Property to "multipart/alternative", the first body part's ContentMediaType Property to "text/plain", and the second body part's ContentMediaType Property to "text/richtext" or "text/html". Alternatively, you can use the IMessage AutoGenerateTextBody Property and the IMessage MimeFormatted Property to automate some of this process. When these properties are both True and you set HTMLBody Property, Collaboration Data Objects (CDO) automatically sets the TextBody property to the plain text equivalent.

To access the corresponding HTML text string, use the IMessage HTMLBody Property. To retrieve the body part object that contains the HTML part of the message, use the IMessage HTMLBodyPart Property.

The plain text is also available as a body part object through the IMessage TextBodyPart Property.

The TextBody property returns an empty string if it has never been set. If you need to determine whether this is the case or whether the plain text is present but currently an empty string, use the IMessage TextBodyPart Property to retrieve the body part containing the text portion of the message.

The default value of TextBody is an empty string.