How to update existing calendar?
I’m using a modified version of the “create a single event” sample
code to update the calendar with events. And I got a function to
retrieve all calendars. What I want to do is use the calendar name I
have retrieved to update a specific calendar by name instead of the
default calendar.
Could anyone help me update this sample code so that it updates a
specific calendar named in a txt string?
And one more question. I haven’t found a way to update the “location”
of a event. Or what is described as “where” in the Google calendar.
Got any tips?
Thank you weary much for any help
/*
* Create new calendar
*/
// Create the calendar service object
var calendarService = new google.gdata.calendar.CalendarService
('GoogleInc-jsguide-1.0');
// The default "owncalendars" feed is used to insert calendar to the
logged-in user
var feedUri = 'http://www.google.com/calendar/feeds/default/
owncalendars/full';
// Create an instance of CalendarEntry, representing the new calendar
var entry = new google.gdata.calendar.CalendarEntry();
// Set the calendar title
entry.setTitle(google.gdata.Text.create('JS-Client: insert
calendar'));
// Set the calendar summary
var summary = new google.gdata.Text();
summary.setText('This is a test calendar created by JS Client');
entry.setSummary(summary);
// Set the calendar timezone
var timeZone = new google.gdata.calendar.TimeZoneProperty();
timeZone.setValue('America/Los_Angeles');
entry.setTimeZone(timeZone);
// Set the calendar location
var where = new google.gdata.Where();
where.setLabel('Mountain View, CA');
where.setValueString('Mountain View, CA');
entry.addLocation(where);
// Set the calendar to be visible in the Google Calendar UI
var hidden = new google.gdata.calendar.HiddenProperty();
hidden.setValue(false);
entry.setHidden(hidden);
// Set the color that represent this calendar in the Google Calendar
UI
var color = new google.gdata.calendar.ColorProperty();
color.setValue('#2952A3');
entry.setColor(color);
// The callback method that will be called after a successful
// insertion from insertEntry()
var callback = function(result) {
PRINT('calendar created!');
}
// Error handler will be invoked if there is an error from insertEntry
()
var handleError = function(error) {
PRINT(error);
}
// Submit the request using the calendar service object
calendarService.insertEntry(feedUri, entry, callback,
handleError, google.gdata.calendar.CalendarEntry);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---