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

This filter retrieves all message with a specific message class from a known administration queue.

This filter removes messages from the queue. When a message with the desired class is found, MSMQQueue.ReceiveCurrentis called to remove the message and MSMQQueue.PeekCurrentis called to look at the next message. When a message is removed from the queue, the cursor is automatically moved to the next message in the queue.

  If you do not want to remove messages from the queue, use MSMQQueue.PeekCurrentto look at the current message, and use MSMQQueue.PeekNextto move the cursor and look at the next message.
To create a message class filter
  1. Declare the MSMQQueueInfo, MSMQQueue, and MSMQMessageobject needed to create the filter.

  2. Call MSMQQueueInfo.Opento open the queue with receive access.

    Receive access allows you to peek at and retrieve messages.

  3. Call MSMQQueue.PeekCurrentto peek at the first message in the queue.

    Before using the cursor to navigate through the queue, you must point the cursor to the first message in the queue.

  4. Filter out the messages in the queue.

    MSMQQueue.ReceiveCurrentand MSMQQueue.PeekCurrentare used if the message is removed.

    MSMQQueue.PeekNextis used if the message is does not fit the search criteria.

  5. Call Closeto close the queue.

See Also