Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Message.TransactionId Property

Gets the identifier for the transaction of which the message was a part.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public string TransactionId { get; }

Property Value

Type: System.String
The identifier for the transaction associated with the message.


The message has not been sent. This property can only be read on messages retrieved from a queue.


The message queue is filtered to ignore the TransactionId property.

Receiving applications use the TransactionId property to verify that a message was sent as part of a specific transaction. The transaction identifier contains the identifier of the sending computer (first 16 bits) followed by a 4-byte transaction sequence number.

This property is available only for Message Queuing version 2.0 and later.

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

You can use the TransactionId property along with the IsFirstInTransaction and IsLastInTransaction properties to verify transaction boundaries.

The following code example displays the value of a message's TransactionId property.

// Display the value of the message's TransactionId property. 
// To view this property value, the queue's 
// MessageReadPropertyFilter.TransactionId property must be set to true 
// before the message is received.
Console.WriteLine("Message.TransactionId: {0}",

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft