NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Message.Body

Gets or sets the serialized contents of the message.

[Visual Basic]
Public Property Body As Object
[C#]
public object Body {get; set;}
[C++]
public: __property Object* get_Body();
public: __property void set_Body(Object*);
[JScript]
public function get Body() : Object;
public function set Body(Object);

Property Value

An object that specifies the message contents to be serialized, including string, date, currency, number, an array of bytes, or any persistent COM object.

Exceptions

Exception Type Condition
InvalidOperationException The Formatter has not been specified.

Remarks

Body provides access to the Body property of the Message Queuing application's MSMQMessage object.

Note   Each Message Queuing message can have no more than 4 megabytes of data.

The BodyType indicates the type of information that is stored in the message body. Message Queuing uses this information to identify the type of the Body.

If the Formatter has not been set for serializing the Body of the message, it defaults to SoapMessageFormatter when the Body is written.

Example [Visual Basic]

The following example creates an empty message. The example populates the Message with a string Body, and then sends the message to a queue. It assumes there is a queue on the computer "myComputer" with the name "myQueue".

Import the System.Messaging namespace for this example.

[Visual Basic]

Private Sub CreateMessage()
    'Declare a message and message queue
    Dim msg As Message
    Dim mq As MessageQueue
    
    'Instantiate an empty message object
    msg = New Message
   
    'Instantiate a new MessageQueue object
    mq = New MessageQueue("myComputer\myQueue")

    'Set message information.
    msg.Body = "New Message Body"
    'Send the message to the queue.
    mq.Send(msg)
End Sub

See Also

Message Class | Message Members | System.Messaging Namespace | Message | BodyStream | BodyType | Formatter | AppSpecific | Extension | UseEncryption | Send | TBD