TextBody Property

Exchange Server 2003

Topic Last Modified: 2004-06-08

The TextBody property specifies the plain text representation of the message.

Property TextBody as String
HRESULT get_TextBody(BSTR* pVal);
HRESULT put_TextBody(BSTR Val);

This property is also available as the urn:schemas:httpmail:textdescription field.

To construct a Multipurpose Internet Mail Extensions (MIME) message that contains both the plain text and Hypertext Markup Language (HTML) versions of the body, you can set the message's IBodyPart.ContentMediaType property to multipart/alternative, the first body part's ContentMediaType to text/plain, and the second body part's ContentMediaType to text/richtext or text/html. Alternatively, you can use the IMessage.AutoGenerateTextBody and IMessage.MimeFormatted properties to automate some of this process. When these properties are both True and you set HTMLBody, Microsoft 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 BodyPart 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 method.

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 is currently an empty string, use the IMessage.TextBodyPart method to retrieve the BodyPart object that contains the text portion of the message.

The default value of the TextBody property is an empty string.