views:

40

answers:

0

I'm using .net and C# to update the google calender from within an application. Everything works perfectly except that an event, whichs spans overnight will not be saved. For example taking an event which lasts from 4.8.2010 09am to 4.8.2010 11am is updated and saved correctly. But using an event which lasts from 4.8.2010 11pm to 5.8.2010 2am will not be saved in the calender.

Here is the code sequence, which fills the properties of the EventEntry. As mentioned before, when StartDate is on the same day as the EndDate, everything works perfectly. But using an EndDate not on the same day as the StartDate, the event is not saved and no error is thrown.

 _calendarFeedString = Properties.Settings.Default.GoogleCalendarFeed;
                        _calendarService = new CalendarService("serviceName");
                        _calendarService.setUserCredentials(_username, _password);
cEntry = new EventEntry();  
            Uri posUri = new Uri(_calendarFeedString);  
            cEntry.Title.Text = row.DutyDetailsToString(true, false);  
            When eventTime = new When(StartDate, EndDate);              
            cEntry.Times.Clear();  
            cEntry.Times.Add(eventTime);  
            cEntry.Categories.Clear();  
            cEntry.Categories.Add(new AtomCategory(cSwissCat));  
            cEntry.Content.Content = ds.Crewmembers.GetCrew(row.ID,false );  
           calendarService.Insert(posUri , cEntry);  

Please check image at: http://filebin.ca/qqnzkz