System.Messaging Reference (Document! X Sample)
System.Messaging Namespace / MessageQueue Class / PeekByCorrelationId Method / PeekByCorrelationId(String) Method
The CorrelationId of the message to peek.



In This Topic
    PeekByCorrelationId(String) Method
    In This Topic
    Peeks the message that matches the given correlation identifier and immediately raises an exception if no message with the specified correlation identifier currently exists in the queue.
    Syntax
    'Declaration
     
    
    Public Overloads Function PeekByCorrelationId( _
       ByVal correlationId As String _
    ) As Message
    'Usage
     
    
    Dim instance As MessageQueue
    Dim correlationId As String
    Dim value As Message
     
    value = instance.PeekByCorrelationId(correlationId)
    public Message PeekByCorrelationId( 
       string correlationId
    )
    public:
    Message^ PeekByCorrelationId( 
       String^ correlationId
    ) 

    Parameters

    correlationId
    The CorrelationId of the message to peek.

    Return Value

    The Message whose CorrelationId matches the correlationId parameter passed in.
    Exceptions
    ExceptionDescription
    The correlationId parameter is null.
    The message with the specified correlationId could not be found.
    An error occurred when accessing a Message Queuing method.
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also