martedì 30 ottobre 2012

C# Google API - Delete Calendar Event

The following code shows how to delete a calendar event


private void DeleteEvent()
        {
            EventQuery query = new EventQuery();
            CalendarService service = new CalendarService("appName");

            service.setUserCredentials("yourMail@gmail.com", "yourPassword");
            service.QueryClientLoginToken();
                   
                     // to get the Uru of the calendar event/feed go to:
                 // C# Google API - Retrieve All Calendar Feeds
            query.Uri = new Uri("the Uri of the event you want to delete");

            EventFeed calFeed = service.Query(query) as EventFeed;
            AtomEntryCollection ee = calFeed.Entries;

            EventEntry ev = ee[0] as EventEntry;
            ev.Delete();
            // delete ok
        }

** I want to remeber to go here http://support.google.com/mail/bin/answer.py?hl=it&answer=1173270 to get  Application-specific password

My Two Cents...

Nessun commento:

Posta un commento