Google Calendar Questions (API)

I would like to use Google Calendar to add party events, so I added a new calendar, "events". Is there a function to delete all events in this calendar?

Or is it possible only by deleting the entire calendar and re-creating it?

I have offline data that is updated daily, so I thought the best way is to clear the entire Google Calendar and just download all the events.

+2
source share
1 answer

This is useful: Google Calendar.NET API Documentation .

// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("jo@gmail.com", "mypassword");

// Create the query object:
EventQuery query = new EventQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/[calendar]/private/full");

[calendar] = "jo@gmail.com" - ( Gmail), https://www.google. //[calendarID]// "

// Tell the service to query:
EventFeed calFeed = myService .Query(query);

// This should delete all items in your calendar

foreach(var item in calFeed.Entries) {
    entry.Delete();
}
+2

All Articles