I am trying to send an outlook appointment from an ASP.NET website. I have found the code for sending this here, and tried to implement it. But for some unknown reason it is not working properly.
My server onto which the code is running is in US/Central timezone. I want to send this appointment to clients who are in London. So there are a Daylight savings issue here, which need to be resolved.
I haven't found any understandable explanation about the strings that are making up the appointment. I think the timezone issue could be resolved with TZOFFSETFROM
and TZOFFSETTO
, but since I don't know how these things work, I couldn't understand what to do.
Can someone please explain those things in plain English?
Edit
Here is the portion of the string that are being used to calculate the timezone -
string timezone = "BEGIN:VTIMEZONE"
+ "\r\n" + "TZID:US/Central"
+ "\r\n" + "X-MICROSOFT-CDO-TZID:11"
+ "\r\n" + "BEGIN:STANDARD"
+ "\r\n" + "DTSTART:16010101T020000"
+ "\r\n" + "TZOFFSETFROM:-0500"
+ "\r\n" + "TZOFFSETTO:-0600"
+ "\r\n" + "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU"
+ "\r\n" + "END:STANDARD"
+ "\r\n" + "BEGIN:DAYLIGHT"
+ "\r\n" + "DTSTART:16010101T020000"
+ "\r\n" + "TZOFFSETFROM:-0600"
+ "\r\n" + "TZOFFSETTO:-0500"
+ "\r\n" + "RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU"
+ "\r\n" + "END:DAYLIGHT"
+ "\r\n" + "END:VTIMEZONE";
Here these two attributes(I don't exactly know their type name, so I am using "attributes" to point to them. My apologies) are used in two places, first after BEGIN:STANDARD
and after BEGIN:DAYLIGHT
. Why? If I specify a start date of DTSTART;TZID=US/Central:20101006T100000Z
in the BEGIN:VEVENT
block, what time it would show at client's outlook who is in London?
Second Edit
OK, I now understand that this VTIMEZONE
defines a specific timezone. After specifying a timezone I need to specify a time for the calender in the VEVENT
section, which is DTSTART;TZID=US/Central:20100101T100000
. Now should this time be current time? I mean, when specifying a time should I consider daylight saving, or just get the current time from that timezone and use it there?
Third Edit
What time should I specify in the following block -
string event = "BEGIN:VEVENT"
+ "\r\n" + "DTSTAMP:{8}"
+ "\r\n" + "DTSTART;TZID=US/Central:{0}" // What time should I specify here?
+ "\r\n" + "SUMMARY:{7}"
.................
Should I consider daylight savings when specifying DTSTART
, or should I always specify standard time and it will be automatically adjusted for daylight savings?
TZOFFSETFROM is the local time offset from GMT when daylight saving time is in operation, TZOFFSETTO is the local time offset from GMT when standard time is in operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With