Body Property

Microsoft Outlook Visual Basic

Returns or sets a String representing the clear-text body of the Microsoft Outlook item. Read/write.

The BodyFormat property allows you to programmatically change the editor that is used for the body of an item.

expression.Body

expression     Required. An expression that returns one of the objects in the Applies To list.

Remarks

Microsoft Office Outlook 2003 inherits the Outlook 2002 object model guard behavior. In addition, it blocks code that attempts to access the Body property of various Outlook items. This allows users to verify that the program or add-in accessing the Body property of items is trustworthy, before they allow access to the contents of the items. Even though this leads to the display of security warnings in the existing COM add-ins that access the Body property of items, this will help prevent malicious code from running without the user being aware of it.

You can avoid the display of security warnings by deriving all objects, properties, and methods from the Application object passed in the OnConnection procedure of the add-in. Outlook trusts only the Application object passed in the OnConnection procedure of the add-in. If you create a new Application object— for example, by using the CreateObject method— that object and any of its subordinate objects, properties, and methods will not be trusted and the blocked properties and methods will throw security warnings.

Example

This Microsoft Visual Basic Scripting Edition (VBScript) example uses the Open event of an item to set its Body property.

Function Item_Open()
    Item.Body = "This is the message body."
End Function