Incorrect received date on some messages (using Redemption)

  • Thread starter Thread starter MA
  • Start date Start date
M

MA

Dear,

Hope I haven't missed something simple.

I used Redemption to create messages, I have noticed in some messages
the time showing in Outlook client are not correct.

For example, the code below set the received message date to "04-
April-2003 7.17pm". However, in my Outlook client it shows "04-
April-2003 8.17pm". Interestingly, other messages in different and
same months shows correct date time.

Is it the ime zone issue? May be its Outlook issue, wondering why the
other messages shows correct time. Btw, I am in GMT +10 time zone.

<code>
RDOFolder rdoFolder = session.GetFolderFromPath(@"\\Test\Inbox");

RDOMail msg = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg.Subject = "Test Message";
RDORecipient recipient = msg.Recipients.Add("(e-mail address removed)");
msg.Sender = session.CurrentUser;

// Received time: 04-April-2003 7.17pm
msg.ReceivedTime = new DateTime(2003, 04, 04, 19, 17, 27, 0);
msg.Save();
</code>

Thanks for the advice.

Regards,
MA
 
As explained above, the code below create message with correct date
"04-May-2003 7.17pm". Any idea why the above code add an hour to the
message time?

<code>
RDOFolder rdoFolder = session.GetFolderFromPath(@"\\Test\Inbox");

RDOMail msg = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg.Subject = "Test Message";
RDORecipient recipient = msg.Recipients.Add("(e-mail address removed)");
msg.Sender = session.CurrentUser;

// Received time: 04-May-2003 7.17pm
msg.ReceivedTime = new DateTime(2003, 05, 04, 19, 17, 27, 0);
msg.Save();
</code>

Environment:
OS: Win XP
Outlook: 2003 11.8217 (SP3)

Thanks,
MA
 
Redemption, like Outlook, will return all named date/time properties in
local time based on your Windows time settings. Internally they are stored
in UTC and are returned as such when a date/time property is accessed using
a Fields collection.

Are all the date/times correct on all items when viewed in the Outlook
object model or a MAPI viewer? Remember that in a MAPI viewer you are
looking at UTC times.
 
Thanks Ken for your response.

I think the issue could be in Outlook client in respect to the day-
light savings.

When I create the message, I can see in VS object inspector (after the
date set) the correct date time, but in Outlook client the time shows
in-correct. If I un-check the Date & Time Properties - "Automatically
adjust clock for daylight savings changes" all date time shows
correctly.

To give you an example:

Step 1. Create two messages with the following code. Both message time
set to 10.37am but two different date.
- Message1 date: 04-April-03 10.37am
- Message2 date: 06-April-03 10.37am

<code>
// Message 1: 04-April-03 10.37am
RDOMail msg1 = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg1.Recipients.Add("(e-mail address removed)");
DateTime date = new DateTime(2003, 04, 04, 10, 37, 0, 0,
DateTimeKind.Utc);
msg1.Subject = string.Format("Message1 : {0}", date.ToString());
msg1.ReceivedTime = date;
msg1.Save();


// Message 2: 06-April-03 10.37am
RDOMail msg2 = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg2.Recipients.Add("(e-mail address removed)");
DateTime date2 = new DateTime(2003, 04, 06, 10, 37, 0, 0,
DateTimeKind.Utc);
msg2.Subject = string.Format("Message2 : {0}", date2.ToString());
msg2.ReceivedTime = date2;
msg2.Save();
</code>

Step 2:
- Time zone: GMT +10 time zone (Sydney)
- Check "Automatically adjust clock for daylight savings changes"
checkbox
- Message 1 shows in Outlook client 11.37am
- Message 2 shows in Outlook client 10.37am

Results: Shows in-correct time for Message 1 (offset by an hour)


Step 3:
- Un-check "Automatically adjust clock for daylight savings changes"
checkbox
- Message 1 shows in Outlook client 10.37am
- Message 2 shows in Outlook client 10.37am

Results: Shows correct time for both messages


In both occasion, using Outlook Spy - ReceivedTime shows 11:37 AM,
4/04/2003.

I don't understand why the Message1 add an hour when "Automatically
adjust clock for daylight savings changes" checked where the Message 2
shows correct time regarless of the daylight savings auto adjust
checkbox

Thanks again for the advice.

Regards,
MA
 
Thanks Ken for your response.

I think the issue could be in Outlook client in respect to the day-
light savings.

When I create the message, I can see in VS object inspector (after the
date set) the correct date time, but in Outlook client the time shows
in-correct. If I un-check the Date & Time Properties - "Automatically
adjust clock for daylight savings changes" all date time shows
correctly.

To give you an example:

Step 1. Create two messages with the following code. Both message time
set to 10.37am but two different date.
- Message1 date: 04-April-03 10.37am
- Message2 date: 06-April-03 10.37am

<code>
// Message 1: 04-April-03 10.37am
RDOMail msg1 = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg1.Recipients.Add("(e-mail address removed)");
DateTime date = new DateTime(2003, 04, 04, 10, 37, 0, 0,
DateTimeKind.Utc);
msg1.Subject = string.Format("Message1 : {0}", date.ToString());
msg1.ReceivedTime = date;
msg1.Save();


// Message 2: 06-April-03 10.37am
RDOMail msg2 = rdoFolder.Items.Add("IPM.Note") as RDOMail;
msg2.Recipients.Add("(e-mail address removed)");
DateTime date2 = new DateTime(2003, 04, 06, 10, 37, 0, 0,
DateTimeKind.Utc);
msg2.Subject = string.Format("Message2 : {0}", date2.ToString());
msg2.ReceivedTime = date2;
msg2.Save();
</code>

Step 2:
- Time zone: GMT +10 time zone (Sydney)
- Check "Automatically adjust clock for daylight savings changes"
checkbox
- Message 1 shows in Outlook client 11.37am
- Message 2 shows in Outlook client 10.37am

Results: Shows in-correct time for Message 1 (offset by an hour)


Step 3:
- Un-check "Automatically adjust clock for daylight savings changes"
checkbox
- Message 1 shows in Outlook client 10.37am
- Message 2 shows in Outlook client 10.37am

Results: Shows correct time for both messages


In both occasion, using Outlook Spy - ReceivedTime shows 11:37 AM,
4/04/2003.

I don't understand why the Message1 add an hour when "Automatically
adjust clock for daylight savings changes" checked where the Message 2
shows correct time regarless of the daylight savings auto adjust
checkbox

Thanks again for the advice.

Regards,
MA
 
Double check to make sure that the time zone settings in Outlook for the
Calendar properties is the same as the time zone settings set up in the
Windows Control Panel settings for time and date. Also make sure the time
zone update for Outlook has been installed.
 
Then I'm not sure. I'd probably experiment with getting the DateTime values
and using ToUTC() and play with that for a while to see if things are being
converted as expected and also try converting back, as well as trying the
MAPIUtils methods for local to UTC and UTC to local to make sure everything
is being converted both ways as expected.
 
Back
Top