Thank you for your reply. But if I don't use public calendar feed, I could not get the list of all calendar feeds displayed in the page. I want to update/insert events on my own calendars. For that reason I should get the events of all calendars displayed in my page.
Best regards, Bharathi On Aug 23, 12:10 am, Ray Baxter <[EMAIL PROTECTED]> wrote: > You are retrieving events from a public feed (see your > EVENT_FEED_URL). Public feeds don't have edit links for the events > that they contain. That's why you are receiving the "entry has no edit > link" error. > > Ray > -- > Ray Baxter > [EMAIL PROTECTED] > > On Aug 22, 2008, at 5:24 AM, Bharathi wrote: > > > > > > > What steps will reproduce the problem? > > 1. please access the web page "http://www.sahrudaya.com/DC.html" > > > 2. I used javascript to communicate with my calendarservices. > > In my page I tried to list all my calendars and the respective events. > > Till that point it is working fine. > > I tried to do some changes to the existing event and save it to the > > calendar. But it is giving error as "entry has no edit link". > > > Then I added an update event code in my program and I was able to > > update > > only my private events. > > // Create a CalendarEventQuery, and specify that this query is > > // applied toward the "private/full" feed > > Here the CalendarEventQuery is not allowing me to give "allcalendars/ > > full" > > feed. > > > What is the expected output? What do you see instead? > > > Can any one help me to resolve this. I would like to save/modify > > events to > > my private as well as public and other calendars(who has given me > > permissions to update their events) programatically. > > > Thank you, > > > Bharathi > > > My program goes like this: > > > <html> > > <head> > > <script type="text/javascript" > > src="http://www.google.com/jsapi?key=mykey"> > > </script> > > <script type="text/javascript"> > > > var DEFAULT_PANE = "default-pane"; > > var AUTHENTICATED_PANE = "authenticated-pane"; > > var AUTH_BUTTON = "auth-button"; > > var LOGOUT_BUTTON = "logout-button"; > > var SAVE_BUTTON = "save-button"; > > var CAL_SELECT = "cal-select"; > > var EVENT_SELECT = "event-select"; > > var TITLE_FIELD = "title-field"; > > var TITLE_CHANGE="title-change"; > > var DATE_FIELD = "date-field"; > > var LOCATION_FIELD = "location-field"; > > var ATTENDEES_FIELD = "attendees-field"; > > var NOTES_FIELD = "notes-field"; > > var STATUS_AREA = "status-area"; > > > var CAL_FEED_URL = "http://www.google.com/calendar/feeds/default/ > > allcalendars/full"; > > var myService; > > var EVENT_FEED_URL; > > var myEventsFeed; > > var myCalFeed; > > > google.load("gdata", "1"); > > > function init() > > { > > google.gdata.client.init(handleError); > > > var token = google.accounts.user.checkLogin(CAL_FEED_URL); > > > myService = > > new google.gdata.calendar.CalendarService("GoogleInc- > > jsguide-1.0"); > > > var authButton = document.getElementById(AUTH_BUTTON); > > > if (google.accounts.user.checkLogin(CAL_FEED_URL)) > > { > > document.getElementById(DEFAULT_PANE).style.display = "none"; > > document.getElementById(AUTHENTICATED_PANE).style.display = > > "inline"; > > getCalendars(); > > } > > else > > { > > document.getElementById(DEFAULT_PANE).style.display = "inline"; > > document.getElementById(AUTHENTICATED_PANE).style.display = > > "none"; > > } > > > reset(); > > }; > > > google.setOnLoadCallback(init); > > > function login() > > { > > var token = google.accounts.user.login(CAL_FEED_URL); > > }; > > > function logout() > > { > > google.accounts.user.logout(); > > init(); > > }; > > > function getCalendars() > > { > > myService.getAllCalendarsFeed(CAL_FEED_URL, handleCalendarFeeds, > > handleError); > > }; > > > function handleCalendarFeeds(myCalFeedResults) > > { > > var calList = document.getElementById(CAL_SELECT); > > calList.onchange = loadCalEvent; > > calList.disabled = false; > > calList.options[calList.selectedIndex].disabled = true; > > calList.options[calList.selectedIndex].text = "Select..."; > > > myCalFeed = myCalFeedResults.feed; > > events = myCalFeed.getEntries(); > > > for (var i = 0; i < events.length; i++) > > { > > var option = document.createElement("option"); > > eventTitle = events[i].getTitle().getText(); > > option.value = i; > > option.appendChild(document.createTextNode(eventTitle)); > > calList.appendChild(option); > > } > > }; > > > function loadCalEvent() > > { > > var calList = document.getElementById(CAL_SELECT); > > var eventList = document.getElementById(EVENT_SELECT); > > var calIndex = calList.options[calList.selectedIndex].value; > > var entries = myCalFeed.getEntries(); > > var calendarEntry = myCalFeed.getEntries()[calIndex]; > > var calendarTitle = calendarEntry.getTitle().getText(); > > if (calendarEntry.getAuthors()[0].getEmail() !=null) > > { > > var calendarTitle1 = (calendarEntry.getAuthors().length > 0) ? > > calendarEntry.getAuthors()[0].getEmail().getValue(): undefined; > > EVENT_FEED_URL = "http://www.google.com/calendar/feeds/" + > > calendarTitle1 + "/public/full"; > > } > > getEvents(); > > }; > > > function getEvents() > > { > > var query = new > > google.gdata.calendar.CalendarEventQuery(EVENT_FEED_URL); > > alert(EVENT_FEED_URL); > > > // Set the start-min parameter to the beginning of today. > > var todayDate = new Date(); > > todayDate.setHours(0); > > todayDate.setMinutes(0); > > todayDate.setSeconds(0); > > todayDate.setMilliseconds(0); > > var today = new google.gdata.DateTime(todayDate, false); > > query.setMinimumStartTime(google.gdata.DateTime.toIso8601(today)); > > > // Set the start-max parameter to the beginning of tomorrow. > > var tomorrowDate = new Date(); > > tomorrowDate.setDate(todayDate.getDate() + 1); > > tomorrowDate.setHours(0); > > tomorrowDate.setMinutes(0); > > tomorrowDate.setSeconds(0); > > tomorrowDate.setMilliseconds(0); > > var tomorrow = new google.gdata.DateTime(tomorrowDate, false); > > > query.setMaximumStartTime(google.gdata.DateTime.toIso8601(tomorrow)); > > > myService.getEventsFeed(query, handleEventsFeed, handleError); > > } > > > function handleEventsFeed(myResultsFeedRoot1) > > { > > var eventList = document.getElementById(EVENT_SELECT); > > eventList.onchange = loadEvent; > > eventList.disabled = false; > > eventList.options[eventList.selectedIndex].disabled = true; > > eventList.options[eventList.selectedIndex].text = "Select..."; > > eventList.options.length = 1; > > > myEventsFeed = myResultsFeedRoot1.feed; > > events = myEventsFeed.getEntries(); > > > for (var i = 0; i < events.length; i++) > > { > > var option = document.createElement("option"); > > eventTitle = events[i].getTitle().getText(); > > option.value = i; > > option.appendChild(document.createTextNode(eventTitle)); > > eventList.appendChild(option); > > } > > }; > > > function loadEvent() > > { > > setStatus(); > > var saveButton = document.getElementById(SAVE_BUTTON); > > saveButton.disabled = false; > > var eventList = document.getElementById(EVENT_SELECT); > > > // If the first option (Select...) is selected, dont do anything > > if (eventList.selectedIndex == 0) { return; } > > > var eventIndex = eventList.options[eventList.selectedIndex].value; > > var event = myEventsFeed.getEntries()[eventIndex]; > > > var title = document.getElementById(TITLE_FIELD); > > title.value = event.getTitle().getText(); > > > var date = document.getElementById(DATE_FIELD); > > date.value = event.getTimes()[0].getStartTime().getDate(); > > > var theLocation = document.getElementById(LOCATION_FIELD); > > theLocation.value = event.getLocations()[0].getValueString(); > > > if (theLocation.value == "undefined") { theLocation.value = ""; } > > > var attendeesDiv = document.getElementById(ATTENDEES_FIELD); > > attendeesDiv.innerHTML = ""; > > > var participants = event.getParticipants(); > > for (var i = 0; i < participants.length; i++) > > { > > var element = document.createElement("div"); > > element.innerHTML = participants[i].getEmail(); > > attendeesDiv.appendChild(element); > > } > > > var notes = document.getElementById(NOTES_FIELD); > > notes.value = event.getContent().getText(); > > if (notes.value == "undefined") { notes.value = ""; } > > }; > > > /* > > * Update an event > > */ > > > function update_Event() > > { > > > var searchText= document.getElementById(TITLE_FIELD).value; > > > // Create a CalendarEventQuery, and specify that this query is > > // applied toward the "private/full" feed > > > var Cal="http://www.google.com/calendar/feeds/default/private/full"; > > var token = google.accounts.user.login(Cal); > > var query = new google.gdata.calendar.CalendarEventQuery(Cal); > > > alert('Calendar URL is:'+Cal); > > > // Set the query with the query text > > query.setFullTextQuery(searchText); > > > // Flag to indicate whether a match is found > > var eventFound = false; > > > // The first matched event entry will have its title updated to this > > string > > > var newTitle= document.getElementById(TITLE_CHANGE).value; > > > // This callback method that will be called when getEventsFeed() > > returns feed data > > var callback = function(result) { > > > // Obtain the array of matched CalendarEventEntry > > > var entries = result.feed.entry; > > > // If there is matches for the full text query > > alert('The length'+ entries.length); > > > if (entries.length > 0) > > { > > // update the first matched event title > > > var event = entries[0]; > > > alert(event.getHtmlLink().getHref()); > > alert('Edit Link is:'+ event.getEditLink().getHref()); > > > event.setTitle(google.gdata.Text.create(newTitle)); > > > event.updateEntry( > > function(result) { > > alert('event updated'); > > },handleError > > ); > > > } > > else > > { > > // No match is found for the full text query > > alert('Cannot find event(s) with text: ' + searchText); > > } > > } > > > // Error handler to be invoked when getEventsFeed() or updateEntry() > > // produces an error > > > var handleError = function(error) { > > alert('handleerror'+error); > > } > > > // Submit the request using the calendar service object > > myService.getEventsFeed(query, callback, handleError); > > > }; > > > function saveEvent() { > > > var eventList = document.getElementById(EVENT_SELECT); > > var eventIndex = eventList.options[eventList.selectedIndex].value; > > var event = myEventsFeed.getEntries()[eventIndex]; > > var title = document.getElementById(TITLE_FIELD).value; > > > var date = new Date(document.getElementById(DATE_FIELD).value); > > event.setTimes(null); > > var when = new google.gdata.When(); > > ... > > read more »- 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 -~----------~----~----~----~------~----~------~--~---
