Share via


Sending a File as a Message (COM)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

Files can be sent as messages by converting the file to an array of bytes, then sending the byte-array as the body of the message.

Note

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

To send a file as a message

  1. Declare an MSMQQueueInfo, MSMQQueue, and MSMQMessage objects, plus a byte array for the file.

  2. Call MSMQQueueInfo.Open to open the destination queue with send access.

  3. Put the file in the body of the message.

  4. Optional. Set additional message properties.

  5. Call MSMQMessage.Send to send the message to the destination queue.

  6. Call MSMQQueue.Close to close the queue.

See Also

Concepts

MSMQ COM Support
Using the COM Components
MSMQ Security

Other Resources

Message Queuing