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 BodyLength property of the MSMQMessage object provides the length of the message body in bytes.

Data type: Long
Run-time access: Read-only
Property BodyLength As Long  

Property Value

A Long containing the length (in bytes) of the message.


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

BodyLength can be used by the sending application or receiving application.

Sending applications can use BodyLength to find the size of the message body as soon as MSMQMessage.Body is set, including before and after the message is sent.

Receiving applications can use BodyLength to find the size of a message before or after retrieving the message body.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_BODY_SIZE.


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