Message Message Message Class


The message object used to communicate and transfer data with Service Bus.

public class Message
type Message = class
Public Class Message


The message structure is discussed in detail in the product documentation.


Message() Message() Message()

Creates a new Message

Message(Byte[]) Message(Byte[]) Message(Byte[])

Creates a new message from the specified payload.


DeadLetterErrorDescriptionHeader DeadLetterErrorDescriptionHeader DeadLetterErrorDescriptionHeader

User property key representing detailed error description, when a message is received from a deadletter subqueue of an entity.

DeadLetterReasonHeader DeadLetterReasonHeader DeadLetterReasonHeader

User property key representing deadletter reason, when a message is received from a deadletter subqueue of an entity.


Body Body Body

Gets or sets the body of the message.

ContentType ContentType ContentType

Gets or sets the content type descriptor.

CorrelationId CorrelationId CorrelationId

Gets or sets the a correlation identifier.

ExpiresAtUtc ExpiresAtUtc ExpiresAtUtc

Gets the date and time in UTC at which the message is set to expire.

Label Label Label

Gets or sets an application specific label.

MessageId MessageId MessageId

Gets or sets the MessageId to identify the message.

PartitionKey PartitionKey PartitionKey

Gets or sets a partition key for sending a message to a partitioned entity.

ReplyTo ReplyTo ReplyTo

Gets or sets the address of an entity to send replies to.

ReplyToSessionId ReplyToSessionId ReplyToSessionId

Gets or sets a session identifier augmenting the ReplyTo address.

ScheduledEnqueueTimeUtc ScheduledEnqueueTimeUtc ScheduledEnqueueTimeUtc

Gets or sets the date and time in UTC at which the message will be enqueued. This property returns the time in UTC; when setting the property, the supplied DateTime value must also be in UTC.

SessionId SessionId SessionId

Gets or sets the session identifier for a session-aware entity.

Size Size Size

Gets the total size of the message body in bytes.

SystemProperties SystemProperties SystemProperties

Gets the Message.SystemPropertiesCollection, which is used to store properties that are set by the system.

TimeToLive TimeToLive TimeToLive

Gets or sets the message’s "time to live" value.

To To To

Gets or sets the "to" address.

UserProperties UserProperties UserProperties

Gets the "user properties" bag, which can be used for custom message metadata.

ViaPartitionKey ViaPartitionKey ViaPartitionKey

Gets or sets a partition key for sending a message into an entity via a partitioned transfer queue.


Clone() Clone() Clone()

Clones a message, so that it is possible to send a clone of an already received message as a new message. The system properties of original message are not copied.

ToString() ToString() ToString()

Returns a string that represents the current message.

Extension Methods

ExtractActivity(Message, String) ExtractActivity(Message, String) ExtractActivity(Message, String)

Creates Activity based on the tracing context stored in the MessageOptional Activity nameNew Activity with tracing context

GetBody<T>(Message, XmlObjectSerializer) GetBody<T>(Message, XmlObjectSerializer) GetBody<T>(Message, XmlObjectSerializer)

Deserializes the body of a message that was serialized using XmlObjectSerializer

Applies to