Updated: July 19, 2016

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 PROPID_M_BODY_TYPE property indicates the format of the message body.

Property ID


Type Indicator




Type of message body. The default is VT_EMPTY.

Set PROPID_M_BODY_TYPE whenever you send a message. If the body type is not set, the application reading the message must assume the message body is an array of bytes. The Message Queuing COM implementation does this automatically.

For information on how Message Queuing functions and COM methods handle different message body types, see Message Body Types.

To set the body type, specify PROPID_M_BODY_TYPE in the MQMSGPROPS structure and call MQSendMessage.

To retrieve the body type, specify PROPID_M_BODY_TYP in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value. When retrieving this property, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

The following table lists all the valid body types.

TypeBody contains
VT_EMPTYDefault. Note that the Message Queuing COM implementation treats this value as an array of bytes.
VT_I1A Char (1 byte) type.
VT_I2A short integer.
VT_I4A long integer.
VT_R4A float (4-byte floating point).
VT_R8A double-float (8-byte floating point).
VT_CYA CURRENCY type (8-byte).
VT_DATEAn OLE DATE (8-byte) type.
VT_BSTRString data in Unicode (does not have to be NULL terminated).
VT_DISPATCHA COM Automation object (IDispatch object).
VT_BOOLA VARIANT_BOOL (2-byte) type, which takes the values of VARIANT_TRUE (-1) and VARIANT_FALSE (0).
VT_UNKNOWNA COM object (IUnknown interface).
VT_UI1A Char (1 byte) type. An array of bytes when joined by the OR operator with VT_ARRAY (VT_ARRAY | VT_UI1).
VT_UI2A short integer.
VT_UI4A long integer.
VT_LPSTRA variable-size, NULL-terminated ANSI string.
VT_LPWSTRA variable-size, NULL-terminated Unicode string.
VT_STREAMED_OBJECTA persistent, serialized object whose format is the output of a call to OleSaveToStream using IPersistStream.
VT_STORED_OBJECTA persistent, serialized object whose format is the output of a call to OleSave using IPersistStorage.
VT_ARRAY | VT_UI1An array of bytes.

Equivalent COM Property

There is no equivalent COM property for the message body type. When you use COM components, Message Queuing sets the body type for you.

The following code fragments show how PROPID_M_BODY_TYPE is specified in arrays that can be used to initialize an MQMSGPROPS structure when setting and retrieving the message body (note this example specifies a string message body):

To Specify the Message Body Type

DWORD dwBodyType = VT_BSTR;                     // Specifies a string  
aMsgPropID[i] = PROPID_M_BODY_TYPE;             // Property ID  
aMsgPropVar[i].vt = VT_UI4;                     // Type indicator  
aMsgPropVar[i].ulVal = dwBodyType;  

To Retrieve the Message Body Type

aMsgPropID[i] = PROPID_M_BODY_TYPE;            // Property ID  
aMsgPropVar[i].vt = VT_NULL;                   // Type indicator  

Message Properties

Community Additions