Export (0) Print
Expand All

MessageQueue.GetAllMessages Method

Returns all the messages that are in the queue.

[Visual Basic]
Public Function GetAllMessages() As Message()
[C#]
public Message[] GetAllMessages();
[C++]
public: Message* GetAllMessages() [];
[JScript]
public function GetAllMessages() : Message[];

Return Value

An array of type Message that represents all the messages in the queue, in the same order as they appear in the Message Queuing queue.

Exceptions

Exception Type Condition
MessageQueueException An error occurred when accessing a Message Queuing API.

Remarks

GetAllMessages returns a static snapshot of the messages in the queue, not dynamic links to those messages. Therefore, you cannot use the array to modify the messages in the queue. If you want real-time, dynamic interaction with the queue (such as the ability to delete messages), call the GetMessageEnumerator method, which returns a dynamic list of the messages in the queue.

Because GetAllMessages returns a copy of the messages in the queue at the time the method was called, the array does not reflect new messages that arrive in the queue or messages that are removed from the queue.

Note    GetAllMessages retrieves only those properties not filtered out by the MessageReadPropertyFilter 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 | Message | GetMessageEnumerator

Show:
© 2014 Microsoft