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!

MessageQueue.MessageReadPropertyFilter

Gets or sets the property filter for receiving messages.

[Visual Basic]
Overridable Public Property MessageReadPropertyFilter As _
   MessagePropertyFilter
[C#]
public MessagePropertyFilter MessageReadPropertyFilter {virtual
   get; virtual set;}
[C++]
public: __property virtual MessagePropertyFilter* get_MessageReadPropertyFilter();
public: __property virtual void set_MessageReadPropertyFilter(MessagePropertyFilter*);
[JScript]
public function get MessageReadPropertyFilter() : MessagePropertyFilter;
public function set MessageReadPropertyFilter(MessagePropertyFilter);

Property Value

The filter used by the queue to limit the set of properties it receives for each message.

Exceptions

Exception Type Condition
ArgumentException The filter was set to a null reference (Visual Basic Nothing).
MessageQueueException The attempt to get or set the message property filter generated an internal error on the message queue component. The error is specified by the given status message.

Remarks

This filter is a set of boolean values that you can set in order to restrict the message properties that the queue receives. Any message property for which the corresponding MessageReadPropertyFilter value is false will not be included when the message is retrieved.

Example [Visual Basic]

The following example uses the MessageReadPropertyFilter to restrict the properties retrieved from a queue. The filtered list of properties for the first message is retrieved.

This example assumes that the Message Queuing server computer's name is "myComputer" and there is a public queue on the computer called "myQueue".

[Visual Basic]

Private Sub ReceiveFilteredMessage()
    'Define a new filter, message, and message queue.
    Dim filter As MessagePropertyFilter
    Dim msg As Message
    Dim mq As MessageQueue

    'Set the filter to retrieve only selected message properties.
    filter = New MessagePropertyFilter
    filter.ArrivedTime = True
    filter.Body = True
    filter.Label = True
    filter.Priority = True
    filter.SentTime = True
    filter.SourceMachine = True

    'Instantialize a new MessageQueue.     
    mq = New MessageQueue("myComputer\myQueue")

    mq.MessageReadPropertyFilter = filter
    'Read the message
    msg = mq.Receive
End Sub

See Also

MessageQueue Class | MessageQueue Members | System.Messaging Namespace | Peek | Receive | BeginPeek | BeginReceive