Share via


MSMQMessage.Body

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The Body property of the MSMQMessage object specifies the contents of the message.

Data type: Variant
Run-time access: Read/write
Property Body As Variant  

Property Value

A Variant of any subtype, including String, Date, Currency, and numeric types, as well as an array of bytes or any persistent COM object that supports IDispatch and IPersist (IPersistStream/IPersistStorage or IPersistStorage).

Remarks

Each Message Queuing message can have no more than 4 MB of data.

When sending messages using COM components, the sending application does not indicate the type of information (string, array of bytes, numeric types, currency, date, or COM object) that is stored in the message body. Message Queuing determines the body type from the true type of the Variant assigned to the Body property.

When assigning an object to the Body property, the Visual BasicĀ® Set operator should not be used. The correct syntax to use is msg.Body = <object reference>. This syntax should be used because the actual object contents are copied into the message buffer, rather than just a reference to the object.

When peeking at or retrieving messages, the receiving application should determine what type of information is in the message body before processing the message body. This can be done using the standard Visual Basic If..Then..Else function with the following conditional functions: TypeOf and TypeName. The TypeName function can be used to find out if the message in the queue is a string, array of bytes, numeric type, currency, or date. If it is not one of these, TypeOf can be used to see which OLE interface the object supports.

Message Queuing COM components ignore any characters that follow the first null character in a string (including in the body of a message) without returning an error.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_BODY.

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: : Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib

See Also

MSMQMessage
PROPID_M_BODY