MSMQCollection.Item

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Introduced in MSMQ 3.0) The Item lookup method of the MSMQCollection object returns a specified element from the collection.

Function Item( _  
  ByRef Index As Variant _  
) As Variant  

Parameters

Index

[in] String that contains the name, or key, of an element in the collection (in C++, a reference to a VARIANT containing a BSTR that identifies the element by name).

Return Values

A Variant that contains the value of the element specified in Index (in C++, a reference to a VARIANT specifying the element).

Error Codes

For a complete list of error and information codes, see Message Queuing Error and Information Codes.

Remarks

The specific elements that can be returned by the Item method for each MSMQCollection object are set internally by Message Queuing and depend on the source of the object. There are three sources of MSMQCollection objects.

  • MSMQCollection objects that are returned by the MSMQOutgoingQueueManagement.EodGetSendInfo method and contain 11 exactly-once-delivery (EOD) information elements. Seven of these elements contain property values for the message stream sent from the outgoing queue. Four are inner MSMQCollection objects that contain property values for specific messages in the message stream:

    EodFirstNonAck (Data type: MSMQCollection)

    An MSMQCollection object that contains sequence information about the first transactional message sent for which an order acknowledgment has not been received.

    EodLastAck (Data type: MSMQCollection)

    An MSMQCollection object that contains sequence information about the last transactional message sent for which an order acknowledgment has been received.

    EodLastAckCount (Data type: Long)

    The number of times that the last order acknowledgment was received.

    EodLastAckTime (Data type: Long)

    The date and time when the last order acknowledgment for a message sent from the outgoing queue specified was received.

    EodLastNonAck (Data type: MSMQCollection)

    An MSMQCollection object that contains sequence information about the last transactional message sent for which an order acknowledgment has not been received.

    EodNextSeq (Data type: MSMQCollection)

    An MSMQCollection object that contains sequence information about the next message to be sent.

    EodNoAckCount (Data type: Long)

    The number of messages sent for which an order acknowledgment has not been received.

    EodNoReadCount (Data type: Long)

    The number of messages sent for which an order acknowledgment has been received but a receive acknowledgment has not been received.

    EodResendCount (Data type: Long)

    The number of times that the last message was sent.

    EodResendInterval (Data type: Long)

    The time interval between the times when the messages are sent.

    EodResendTime (Data type: Long)

    The time when the next messages will be resent from the outgoing queue.

  • MSMQCollection objects that are elements in the array of MSMQCollection objects returned by the MSMQQueueManagement.EodGetReceiveInfo method. Each MSMQCollection object in such an array represents a source computer and contains the following elements:

    QueueFormatName (Data type: String)

    The format name used to send the messages to the destination queue.

    SenderID (Data type: Variant)

    The GUID of the sending queue manager connected to the queue.

    SeqID (Data type: Variant)

    The 64-bit sequence identifier of the message stream containing the last message sent to the queue by the sending queue manager.

    SeqNo (Data type: Long)

    The sequence number of the last message sent to the queue by the sending queue manager.

    LastAccessTime (Data type: Long)

    The time when the sending queue manager last accessed the queue.

    RejectCount (Data type: Long)

    The number of times the message was rejected before it was accepted by the receiving queue manager.

  • MSMQCollection objects that are elements of an MSMQCollection object returned by the MSMQOutgoingQueueManagement.EodGetSendInfo method.

    The inner collection in these elements contains the following three elements:

    SeqID (Data type: Variant)

    The 64-bit sequence identifier of the message stream being sent to the destination queue.

    SeqNo (Data type: Long)

    The sequence number of the first unacknowledged message that was sent to the destination queue.

    PrevNo (Data type: Long)

    The previous sequence number specified in the message. The message can be delivered only if a message whose sequence number is equal to this number is present in the destination queue.

The Item method is the default method for the MSMQCollection object. Therefore, the following lines of code are equivalent:

Msgbox "Last order acknowledgment was at: " & MyMSMQCollection.Item
("EodLastAckTime")  
Msgbox "Last order acknowledgment was at: " & MyMSMQCollection
("EodLastAckTime")  

The Set keyword must be included when the element specified in Index is also an MSMQCollection object.

Because the MSMQCollection object is read-only, this method cannot be used to set an element in the collection.

Requirements

Windows NT/2000/XP: Included in Windows XP and Windows Server 2003.

Windows 95/98/Me: Unsupported.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib

See Also

MSMQCollection
MSMQOutgoingQueueManagement.EodGetSendInfo
MSMQQueueManagement.EodGetReceiveInfo