MAPI Received Time 1 Hour Earlier Than Outlook 2003 Received Time

G

Guest

Can anyone help. I am using VB 6 and MAPI to get email information from a
mailbox open in outlook 2003. The received time in outlook is for instance
13:10. This is displayed in the inbox. But the received time using MAPI is
always 1 hour earlier, for instance 12:10. Why? The time being displayed by
outlook is the correct time. Can this time be got at through the MAPI
interface?
 
K

Ken Slovak - [MVP - Outlook]

When you say you're using MAPI, which MAPI library are you using?

In MAPI all PT_SYSTIME values are stored in GMT and then converted into
local time by Outlook. So are you off from GMT by 1 hour? If so you will
need to do your own conversion.
 
G

Guest

Im using CDO 1.2.1. As far as i'm aware all the computers are on GMT. The
system is running in the UK. How do know if I need to do the conversion. What
values do I have to check?
 
K

Ken Slovak - [MVP - Outlook]

OK, with CDO there can be a disconnect between your Windows and Outlook
settings and what CDO is doing.

Outlook and Windows use a registry value to determine the user's time zone.
Then when you get a date using the Outlook object model that local time zone
is used to convert the stored GMT values to local time.

CDO on the other hand looks at the registry settings but also looks at the
first DWORD of property 0x7D020102 in the Inbox, which is the property
that's used for Session.GetOption("TimeZone") and for SetOption.

CDO will usually revert to using GMT and not convert to local time if the
property DWORD doesn't match up with the registry setting, but it can get
confused easily. Things that can corrupt that DWORD include logging into a
mailbox from a different time zone where the computer is set for that
different time zone, and logging into a mailbox using OWA from a kiosk or
machine in a different time zone.

I'd suggest running a simple macro to display the value of
Session.GetOption("TimeZone") and see if it matches the value for your time
zone as listed in the CDO.HLP file. If it's incorrect then you can use
SetOption to correct that DWORD.
 
G

Guest

Hi Ken,

I have looked at the timezone value and it is 1, which is correct for my
timezone. I am having this problem on a customers site, the emails have the
correct date/time in outlook but the wrong date/time using CDO. I dont have
this problem on my computer, but when I forward an email from my customers
site to me the email has the correct date/time in outlook but the wrong
date/time in CDO, but only for the emails forwarded from the customers site,
not the ones already in the inbox.

I have used a UTC to local time conversion function which converts all the
customers forwarded emails to the correct date/time (adds 1 hour) but it also
adds 1 hour to all the emails that were already in the inbox and correct
anyway. Is there a way to check which emails need converting and which dont?

Also how does outlook know which to change and which to leave? Is it
possible to use the same function outlook uses?

I could use the outlook object model to get the date/time but it would mean
re-writing parts of my code and also this seems abit over-kill just to get
the date/time. Surely theres a function which can be used with CDO to do this?

Kind regards,

Matt
 
K

Ken Slovak - [MVP - Outlook]

I'd check that DWORD on the client too.

There's no way to tell which messages need to be converted and which don't.
Basically all date values are converted automatically by Outlook into local
time from GMT.

I'd check on the client computer that their Outlook time zone settings match
their Windows settings in addition to checking the DWORD that CDO uses. For
Outlook it's in Tools, Options, Calendar Options, Time Zones. For Windows
it's in the date/time settings in the control panel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top