private void Delete_Click(object sender, EventArgs e) { try { CalendarService oCalendarService = GAuthenticate(); //Search for Event EventQuery oEventQuery = new EventQuery( new Uri("http://www.google.com/calendar/feeds/" + ((CalendarEntry)(GoogleCalendar.SelectedItem)).SelfUri.ToString().Substring(((CalendarEntry)(GoogleCalendar.SelectedItem)).SelfUri.ToString().LastIndexOf("/") + 1) + "/private/full").ToString ()); oEventQuery.ExtraParameters = location.Text; Google.GData.Calendar.EventFeed oEventFeed = oCalendarService.Query(oEventQuery); //Delete Related Events foreach (EventEntry oEventEntry in oEventFeed.Entries) { oEventEntry.Delete(); break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private CalendarService GAuthenticate() { string sGoogleUserName = UserName.Text; string sGooglePassword = Password.Text; Uri oCalendarUri = new Uri(new Uri("http://www.google.com/calendar/feeds/" + ((CalendarEntry)(GoogleCalendar.SelectedItem)).SelfUri.ToString().Substring(((CalendarEntry)(GoogleCalendar.SelectedItem)).SelfUri.ToString().LastIndexOf("/") + 1) + "/private/full").ToString()); //Initialize Calendar Service CalendarService oCalendarService = new CalendarService("CalendarSampleApp"); oCalendarService.setUserCredentials(sGoogleUserName, sGooglePassword); //Use Proxy GDataRequestFactory oRequestFactory = (GDataRequestFactory)oCalendarService.RequestFactory; WebProxy oWebProxy = new WebProxy(WebRequest.DefaultWebProxy.GetProxy(oCalendarUri)); oWebProxy.Credentials = CredentialCache.DefaultCredentials; oWebProxy.UseDefaultCredentials = true; oRequestFactory.Proxy = oWebProxy; return oCalendarService; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)