This is just the ' Retrieve all calendars' interactive sample code from the 
Developers guide with just a 1 line addition to retrieve the id!

/* 
 * Retrieve all calendars 
 */

// Create the calendar service object
var calendarService = new google.gdata.calendar.CalendarService(
'GoogleInc-jsguide-1.0');

// The default "allcalendars" feed is used to retrieve a list of all 
// calendars (primary, secondary and subscribed) of the logged-in user
var feedUri = 
'http://www.google.com/calendar/feeds/default/allcalendars/full';

// The callback method that will be called when getAllCalendarsFeed() 
returns feed data
var callback = function(result) {

  // Obtain the array of CalendarEntry
  var entries = result.feed.entry;
  
  for (var i = 0; i < entries.length; i++) {
    var calendarEntry = entries[i];
    var calendarTitle = calendarEntry.getTitle().getText();    
    var calendarId = calendarEntry.getId().getValue();
    PRINT('Calendar title = ' + calendarTitle+'      Id= ' + calendarId);
  }
}

// Error handler to be invoked when getAllCalendarsFeed() produces an error
var handleError = function(error) {
  PRINT(error);
}

// Submit the request using the calendar service object
calendarService.getAllCalendarsFeed(feedUri, callback, handleError);


-- 
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://code.google.com/apis/calendar/community/forum.html

Reply via email to