Platform SDK: CDO 1.2.1

TimeReceived Property (Message Object)

The TimeReceived property sets or returns the date/time the message was received as a vbDate variant data type. Read/write.

Syntax

objMessage.TimeReceived

Data Type

Variant (vbDate format)

Remarks

The TimeReceived and TimeSent properties set and return dates and times as the local time for the user’s system.

When you send messages using the Message object’s Send method, MAPI sets the TimeReceived and TimeSent properties for you. However, when you post messages in a public folder, you must first explicitly set these properties. For a message posted to a public folder, set both properties to the same time value.

The TimeReceived and TimeSent properties represent local time.

AppointmentItem objects in a Microsoft® Schedule+ calendar folder do not have the full set of attributes of a general message. If you obtain the default calendar folder by passing CdoDefaultFolderCalendar to the Session object's GetDefaultFolder method, its appointments have no defined value for the TimeReceived property. An attempt to access TimeReceived in this case returns CdoE_NOT_FOUND.

The TimeReceived property corresponds to the MAPI property PR_MESSAGE_DELIVERY_TIME. It can be rendered into HTML hypertext using the CDO Rendering ObjectRenderer object. To specify this, set the object renderer's DataSource property to this Message object and the property parameter of the RenderProperty method to CdoPR_MESSAGE_DELIVERY_TIME.

Note  When PR_MESSAGE_DELIVERY_TIME is rendered into HTML, it is converted to the local time at IIS, not the browser's local time.

Example

This code fragment displays the date/time a message was sent and received:

' from the sample function Message_TimeSentAndReceived 
' verify that objOneMsg is valid, then ... 
With objOneMsg 
    strMsg = "Message sent " & Format(.TimeSent, "Short Date") 
    strMsg = strMsg & ", " & Format(.TimeSent, "Long Time") 
    strMsg = strMsg & "; received " 
    strMsg = strMsg & Format(.TimeReceived, "Short Date") & ", " 
    strMsg = strMsg & Format(.TimeReceived, "Long Time") 
    MsgBox strMsg 
End With