Hi, Sample JS code to delete using a Query object - // DELETE EVENT
var feedUri = 'http://www.google.com/calendar/feeds/default/private/full'; // find the event with matching text to delete var searchText = 'test'; var query = new google.gdata.calendar.CalendarEventQuery(feedUri); query.setFullTextQuery(searchText); var callback = function(root) { var entries = root.feed.getEntries(); //delete the first matched event if (entries.length > 0) { entries[0].deleteEntry( function() { alert('event is deleted'); }, handleError ); } }; calendarService.getEventsFeed( query, callback, handleError ); Hope it helps, Austin On Feb 1, 2008 1:31 PM, warrenjb <[EMAIL PROTECTED]> wrote: > > Thanks Austin. So how do I incorporate this into a delete? (see > below) > <html> > <head> > <script type="text/javascript" > src="http://www.google.com/jsapi? > > key=ABQIAAAACNciPTmDCjE1_9RvQBjjchRneDYLKsC206mjtCIaAEgA4swSsRRPm2hLXAyB0pMy9k5VAYBXcmyt4Q > "> > </script> > <script> > google.load("gdata", "1.x"); > google.setOnLoadCallback(getMyFeed); > > var feedUrl = "http://www.google.com/calendar/feeds/default/private/ > full"; > function setupMyService() { > var myService = > new google.gdata.calendar.CalendarService('exampleCo- > exampleApp-1'); > return myService; > } > function getMyFeed() { > myService = setupMyService(); > searchMyFeed(); > } > function searchMyFeed() { > var myQuery = new google.gdata.calendar.CalendarEventQuery > (feedUrl); > myQuery.setFullTextQuery("Patient Id: " + patient); > myQuery.setParam('start-min', starttimex); > myQuery.setParam('start-max', starttimex); > var callback = function(root) { > var entries = root.feed.getEntries(); > var entry = entries[0]; > } > myService.getEventsFeed(myQuery, callback); > deleteMyEntry(callback); > } > function deleteMyEntry(myResultsEntryRoot) { > myResultsEntryRoot.entry.deleteEntry(handleMyDeletedEntry); > } > function handleMyDeletedEntry() { > alert("Calendar Updating"); > } > > </script> > </head> > > On Feb 1, 3:21 pm, "Austin (Google)" <[EMAIL PROTECTED]> wrote: > > Hi, > > You are not using the Query object correctly. The Query object doesn't > > return result by itself, it is passed to a feed request method as an > > argument and you would use a callback method to iterate through the > result > > set to look for the event that you are looking for. This is an example > of > > how to do a feed query using the Query object - > > > > // QUERY EVENT > > > > var searchText = 'test'; > > > > var feedUri = 'http://www.google.com/calendar/feeds/default/private/full > '; > > > > var query = new google.gdata.calendar.CalendarEventQuery(feedUri); > > query.setFullTextQuery(searchText); > > > > var callback = function(root) { > > var entries = root.feed.getEntries(); > > > > for (var i=0;i<entries.length ;i++ ) { > > var entry = entries[i]; > > PRINT('event title: ' + entry.getTitle().getText()); > > } > > > > } > > > > calendarService.getEventsFeed( > > query, callback, handleError > > ); > > > > Austin > > > > On Feb 1, 2008 9:18 AM, warrenjb <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > I've made some progress in identifying the URI (I think). However I > > > must be doing something wrong when I execute the delete. Can anyone > > > help? > > > > > var feedUrl = "http://www.google.com/calendar/feeds/default/private/ > > > full"; > > > function getMyFeed() { > > > myService = setupMyService(); > > > searchMyFeed(); > > > myService.getEventsFeed(feedUrl, insertIntoMyFeed); > > > } > > > function setupMyService() { > > > var myService = > > > new google.gdata.calendar.CalendarService('exampleCo- > > > exampleApp-1'); > > > return myService; > > > } > > > function searchMyFeed() { > > > var myQuery = new google.gdata.calendar.CalendarEventQuery(feedUrl); > > > myQuery.setFullTextQuery("Pat Id: " + pat); > > > myQuery.setParam('start-min', starttimex); > > > myQuery.setParam('start-max', starttimex); > > > var uri = myQuery.getUri(); > > > deleteMyEntry(uri); > > > } > > > function deleteMyEntry(myResultsFeedRoot) { > > > myResultsFeedRoot.deleteEntry(handleMyDeletedEntry); > > > } > > > function handleMyDeletedEntry() { > > > alert("Calendar Updating"); > > > } > > > > > On Jan 31, 2:28 pm, warrenjb <[EMAIL PROTECTED]> wrote: > > > > I need to delete an event. I don't know the event id but I do know > > > > the title, location, description and start time (none of these are > > > > unique by themselves - only together do they create a unique event). > > > > It looks like I should be able to query the calendar based on these > > > > criteria and then delete the event but all I saw was a > fulltextsearch > > > > and I'm not sure how that would help. What is the best way to find > a > > > > specific event based on title, location, description and time and > then > > > > delete it? By the way I'm using javascript.- Hide quoted text - > > > > - Show quoted text - > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
