title: How to delete all event entries from a specific calendar from Google calendar API .NET
body: <p>I am trying editing a tool to allow a user to select from a list of their calendars and then clear all event entries / add new ones based on Microsoft project tasks.
  Heres the original tool: <a href="http://daball.github.com/Microsoft-Project-to-Google-Calendar/" rel="nofollow noreferrer">http://daball.github.com/Microsoft-Project-to-Google-Calendar/</a></p>
  
  <p>I am completely unexperienced with Google APIs / the calendar API, and am having some trouble. The program I'm editing keeps track of which CalendarEntry the user has selected from a list of their calendars. What I am currently trying to do is create a EventFeed which gives me the EventEntries of that selected calendar, so I can then delete all of them. The purpose of this is to allow someone to use this tool to also update the calendar from the project file whenever changes are made. Here's my function attempting the delete.</p>
  
  <pre><code> private void clearPreviousCalendarEntries(CalendarEntry calendarEntry)
      {      
          EventQuery query = new EventQuery();
          query.Uri = new Uri(calendarEntry.Links[0].AbsoluteUri);
  
          EventFeed feed = (EventFeed)calendarService.Query(query);
  
          AtomFeed batchFeed = new AtomFeed(feed);
  
          foreach (EventEntry entry in feed.Entries)
          {
              entry.Id = new AtomId(entry.EditUri.ToString());
              entry.BatchData = new GDataBatchEntryData(GDataBatchOperationType.delete);
              batchFeed.Entries.Add(entry);
          }
  
          EventFeed batchResultFeed = (EventFeed)calendarService.Batch(batchFeed, new Uri(feed.Batch));
  
          foreach (EventEntry entry in batchResultFeed.Entries)
          {
              if (entry.BatchData.Status.Code != 200 &amp;&amp; entry.BatchData.Status.Code != 201)
                  this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Problem deleteing " + entry.Title.Text + " error code: " + entry.BatchData.Status.Code);
              else
                  this.listBoxResults.SelectedIndex = this.listBoxResults.Items.Add("Deleted " + entry.Title.Text);
          }
  
      }
  </code></pre>
  
  <p>My feed doesn't return the results I was hoping for, but to be honest I'm not sure how to request the events correctly.</p>
  
  <p><code>query.Uri = new Uri(calendarEntry.Links[0].AbsoluteUri);</code> is something I grabbed from the portion of the program which is adding event to a specific calendar</p>
  
  <p><code>AtomEntry insertedEntry = calendarService.Insert(new Uri(calendarEntry.Links[0].AbsoluteUri), eventEntry);</code></p>
  
  <p>These posts are definitely related to what I'm looking for but I haven't arrived at a solution</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4019517/google-calendar-get-events-from-a-specific-calendar" >google-calendar-get-events-from-a-specific-calendar</a></li>
  <li><a href="http://www.google.com/support/forum/p/apps-apis/thread?tid=2e8b8003b1aa5fd9&hl=en" rel="nofollow noreferrer">how can i retrieve a event exclusive from a calendar that i created (not default one)?</a> </li>
  </ul>