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

(Read-only, introduced in MSMQ 2.0.) The PROPID_M_XACTID property indicates which transaction sent the message.

Property ID


Type Indicator




Identifier of the transaction. See Remarks for a description of a transaction identifier.

This property is available for MSMQ 2.0 and later. It is used by receiving applications to verify that a message was sent from a specific transaction. The transaction identifier is a 20-byte identifier that includes the computer identifier of the sending machine (first 16 bytes) followed by a transaction sequence number (4 bytes).

Transaction identifiers are not guaranteed to be unique because the transaction sequence numbers are not persistent and they start over again at 2^20. Message Queuing guarantees only that successive transactions will have different transaction sequence numbers.

You can use PROPID_M_XACTID along with two other properties to verify transaction boundaries. These two properties are properties for identifying the first and last message sent in a transaction: PROPID_M_FIRST_IN_XACT and PROPID_M_LAST_IN_XACT.

To retrieve the transaction identifier of a message, specify PROPID_M_XACTID and a buffer consisting of 20 unsigned characters to receive its value in the MQMSGPROPS structure.

System_CAPS_ICON_note.jpg Note

The buffer must consist of exactly 20 unsigned characters. Specifying either a smaller or larger buffer will result in an error.

The size of the buffer can be specified by the constant PROPID_M_XACTID_SIZE. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned identifier.

Equivalent COM Property

With COM components, the equivalent property for retrieving the transaction identifier is MSMQMessage.TransactionId.

For information onSee
How transaction boundaries can be usedChecking for Transaction Boundaries when Receiving Messages
Identifying the first message in the transactionPROPID_M_FIRST_IN_XACT
Identifying the last message in the transactionPROPID_M_LAST_IN_XACT

The following code fragment shows how PROPID_M_XACTID is specified in arrays that can be used to initialize an MQMSGPROPS structure.

aMsgPropId[i] = PROPID_M_XACTID;        // Property ID  
aPropVar[i].vt = VT_VECTOR | VT_UI1;    // Type indicator  
aPropVar[i].caub.pElems = rgucXactID;  
aPropVar[i].caub.cElems = PROPID_M_XACTID_SIZE;  

The following example is included in Using Message Queuing.

For an example ofSee
Identifying the first and last messages in a transactionC/C++ Code Example: Checking Transaction Boundaries

Message Properties