This documentation is archived and is not being maintained.

MessageQueue.Send Method (Object, MessageQueueTransactionType)

.NET Framework 1.1

Sends an object to the queue referenced by this MessageQueue.

[Visual Basic]
Overloads Public Sub Send( _
   ByVal obj As Object, _
   ByVal transactionType As MessageQueueTransactionType _
)
[C#]
public void Send(
 object obj,
 MessageQueueTransactionType transactionType
);
[C++]
public: void Send(
 Object* obj,
 MessageQueueTransactionType transactionType
);
[JScript]
public function Send(
   obj : Object,
 transactionType : MessageQueueTransactionType
);

Parameters

obj
The object to send to the queue.
transactionType
One of the MessageQueueTransactionType values, describing the type of transaction context to associate with the message.

Exceptions

Exception Type Condition
MessageQueueTransaction The Message Queuing application indicated an incorrect transaction usage.
InvalidEnumArgumentException The transactionType parameter is not one of the MessageQueueTransactionType members.
MessageQueueException The Path property has not been set.

-or-

An error occurred when accessing a Message Queuing API.

Remarks

Use this overload to send a message containing the obj parameter to the queue referenced by the MessageQueue, using a transaction context defined by the transactionType parameter. Specify Automatic for the transactionType parameter if there is already an external transaction context attached to the thread that you want to use to send the message. Specify Single if you want to send the message as a single internal transaction. You can specify None if you want to send a transactional message to a nontransactional thread.

The object you send to the queue can be a Message or any managed object. If you send any object other than a Message, the object is serialized and inserted into the body of the message.

If you do not set the Formatter property before calling Send, the formatter defaults to the XmlMessageFormatter.

The DefaultPropertiesToSend property applies to any object other than a Message. If you specify, for example, a label or a priority using the DefaultPropertiesToSend member, these values apply to any message that contains an object that is not of type Message when your application sends it to the queue. When sending a Message, the property values set for the Message take precedence over DefaultPropertiesToSend, and the message's Message.Formatter property takes precedence over the queue's MessageQueue.Formatter property.

The following table shows whether this method is available in various Workgroup modes.

Workgroup Mode Available
Local computer Yes
Local computer + direct format name Yes
Remote computer No
Remote computer + direct format name Yes

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MessageQueue.Send Overload List | MessageQueueTransactionType | DefaultPropertiesToSend | Message | Transactional | Peek | Receive | BeginPeek | BeginReceive

Show: