I am trying to insert event in google calendar using google api v3 and getting error during insertion.I am using c#.
Error:
Google.Apis.Requests.RequestError
Invalid or mismatching start and end times. [400]
Errors [Message[Invalid or mismatching start and end times.] Location[ - ] Reason[invalid] Domain[global]
My code for EventDateTime is here.
EventDateTime EventStartDTime = new EventDateTime();
EventStartDTime.Date = "2013-06-03";
EventStartDTime.DateTime = "2013-06-03T10:00:00.000+05:00";
EventStartDTime.TimeZone = "Asia/Karachi";
EventDateTime EventEndtDTime = new EventDateTime();
EventEndtDTime.Date = "2013-06-05";
EventEndtDTime.DateTime = "2013-06-05T10:00:00.000+05:00";
EventEndtDTime.TimeZone = "Asia/Karachi";
Can Anyone help me to solve this issue?
Google calendar V3 API timestamp requires UTC format so you can mention datetime and timezone(optional) so you should provide the below format, which takes current timezone automatically:
hope this help.
When updating (rather than creating) events at a certain time, specifying the time zone as in darthlukan's answer didn't work for me. However, setting the DateTimeKind to local time did the trick:
This is the final code, It is working fine now:
After reading the docs here it looks like the offset that you're providing is optional. From the docs:
Try removing the offset in your DateTime variable or removing the TimeZone variable. In my own tests using Python this worked for me. Example of my code (relevant portion of dictionary):
I hope that helps.