Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
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 MSMQMessageobjects, plus a byte array for the file.

  2. Call MSMQQueueInfo.Opento 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.Sendto send the message to the destination queue.

  6. Call MSMQQueue.Closeto close the queue.

See Also