none
outlookMessage.ReceivedTime changing? RRS feed

  • Question

  • Good day,

    Has anyone experienced the outlookMessage.ReceivedTime property change time (in seconds). Sometimes I extract data and it's for ex. 10:42:00, and sometimes it's 10:42:40?

    Thank you

    
    Friday, September 26, 2014 1:40 PM

All replies

  • When exactly does it change? How and when do you access the property? Why is it a problem?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, September 26, 2014 1:43 PM
  • I import data into Excel from Outlook (both 2010) using vba. When I import I compare the data that is already in Excel with the data taken from the Inbox, using data from the body of the email and the received time.

    Since received time changes, vba thinks that these are two different records and adds a dublicate to Excel.

    I use outlookMessage.ReceivedTime property in

    Set myOutlook = createObject ("Outlook Application")

    Set outlookNamespace = myOutlook.GetNamespace("MAPI")

    Set outlookFolder = outlookNamespace.Folders.Item(2).Folder(6)

    For Each outlookMessage in the outlookFolder.Items

    .......

    Friday, September 26, 2014 2:03 PM
  • Hello Alex,

    You can format the time using the Format function to ignore the seconds part. I think it will solve the issue you faced with.

    For example: Format(Now, "Short Time")
    Friday, September 26, 2014 2:29 PM
  • Eugene,

    Thanks.

    Is there anyway to keep the seconds? What could possibly be changing the time? Windows Clock Sych?

    Friday, September 26, 2014 3:20 PM
  • What exactly makes you think that the value changes? When does it change? When you read it from the MailItem.ReceivedTime property?

    Can you see this behavior in OutlookSpy (select the message, click Item button, select the ReceivedTime property)?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, September 26, 2014 4:17 PM
  • I always get the same value in Outlook. Dmitry is asking the right questions. Where and when do you get the values?
    Friday, September 26, 2014 5:35 PM
  • They don't switch everytime. They switch maybe once every 5-10 days.

    I use outlookMessage.ReceivedTime property in
     
    Set myOutlook = createObject ("Outlook Application")
     
    Set outlookNamespace = myOutlook.GetNamespace("MAPI")
     
    Set outlookFolder = outlookNamespace.Folders.Item(2).Folder(6)
     
    For Each outlookMessage in the outlookFolder.Items
    

    
    Friday, September 26, 2014 6:20 PM
  • Okay. Where and when do you run that code?

    Do you use the Exchange server in the profile?
    Friday, September 26, 2014 7:10 PM
  • No it's all simple.

    I run this code on only one computer, once a day to update my excel sheet records. And every once in a while the .ReceiveTime gives me different seconds, and all my records double.

    I only see the problem with the Windows system time sync, since ReceivedTime is derived from system clock. But it's locked under admin privilages.

    Can anything else be of a factor?

    Friday, September 26, 2014 7:31 PM
  • It looks like you forgot to answer my question. Do you have an Exchange server account set up in Outlook?
    Friday, September 26, 2014 7:45 PM
  • Yes I do have Exchange server account
    Friday, September 26, 2014 8:03 PM
  • Did you have a chance to test a regular POP3/SMTP profile? Does the issue come from Exchange only?
    Friday, September 26, 2014 8:17 PM
  • No I haven't. But then again, I cannot replicate the error. As I mentioned earlier, it happens every few days.
    Friday, September 26, 2014 8:22 PM
  • Yes, I remember. Do you have the cached mode enabled in Outlook?

    Also try to reproduce the issue with a regular mail account (POP3/SMTP).
    Friday, September 26, 2014 9:31 PM
  • Chached mode is enabled
    Friday, September 26, 2014 10:00 PM
  • Alex,

    To find the real cause I'd suggest trying to use the non-cached mode also. Most probably it comes from the exchange server.

    Outlook Spy or MFCMAPI utilities can be used for exploring the property value.

    Saturday, September 27, 2014 11:54 AM