Read-only. The SentTime property indicates when a message was sent.
| Type: | Date Variant |
| Run time: | read-only |
object.SentTime
| Syntax Element | Description |
| object | Message (MSMQMessage) object that defines the message. |
Date message was sent.
The returned value for this property can be manipulated using standard Microsoft® Visual Basic® date and time functions such as Date$, and Time$. For descriptions of Visual Basic functions, see the Visual Basic documentation.
When SentTime is displayed, Visual Basic will automatically convert the parameter's value to the local system time and system date.
This example locates a destination queue (creating one if one does not exist), sends a message to the queue, then reads the message and displays when the message was sent.
To try this example using Microsoft Visual Basic (version 5.0), paste the code into the Code window of a form, and then run the example and click the form.
Dim query As New MSMQQuery
Dim qinfos As MSMQQueueInfos
Dim qinfoDest As MSMQQueueInfo
Dim qDest As MSMQQueue
Dim msgSent As New MSMQMessage
Dim msgRead As MSMQMessage
Private Sub Form_Click()
'**********************************
' Locate destination queue
'(create one if one doesn't exist).
'**********************************
Set qinfos = query.LookupQueue(Label:="Destination Queue")
qinfos.Reset
Set qinfoDest = qinfos.Next
If qinfoDest Is Nothing Then
Set qinfoDest = New MSMQQueueInfo
qinfoDest.PathName = ".\DestQueue"
qinfoDest.Label = "Destination Queue"
qinfoDest.Create
End If
'**************
' Send Message.
'**************
Set qDest = qinfoDest.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
msgSent.Label = "Test Message"
msgSent.Body = "This message tests the message timers."
msgSent.Send qDest
qDest.Close
'******************************************
' Remove the message from destination queue
' and display when the message was sent.
'******************************************
Set qDest = qinfoDest.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
Set msgRead = qDest.Receive
MsgBox "The message was sent at: " + CStr(msgRead.SentTime)
End Sub
Body, Close, Create, Label, LookupQueue, MSMQMessage, MSMQQuery, MSMQQueue, MSMQQueueInfo, MSMQQueueInfos, Next, Open, PathName, Receive, Send