Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

MessageQueue.ReceiveByLookupId Method (Int64)

Introduced in MSMQ 3.0. Receives the message that matches the given lookup identifier from a non-transactional queue.

Namespace:  System.Messaging
Assembly:  System.Messaging (in System.Messaging.dll)

public Message ReceiveByLookupId(
	long lookupId


Type: System.Int64

The LookupId of the message to receive.

Return Value

Type: System.Messaging.Message
The Message whose LookupId property matches the lookupId parameter passed in.


MSMQ 3.0 is not installed.


The message with the specified lookupId could not be found.


An error occurred when accessing a Message Queuing method.

Use this method to read a message with a known lookup identifier and remove it from the queue. This method throws an exception immediately if the message is not in the queue.

The LookupId property of a message is unique to the queue where the message resides, so there will be at most one message in the queue that matches the given lookupId parameter.

To read a message with a specified lookup identifier without removing it from the queue, use the PeekByLookupId method.

The following table shows whether this method is available in various Workgroup modes.

Workgroup mode


Local computer


Local computer and direct format name


Remote computer


Remote computer and direct format name


.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
© 2015 Microsoft