Message.TransactionId Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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.

Exception Condition

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.

.NET Framework
Available since 1.1
Return to top