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(); when.setStartTime(date); when.setEndTime(date); event.addTime(when); var theLocation = document.getElementById(LOCATION_FIELD).value; event.getLocations()[0].setValueString(theLocation); var notes = document.getElementById(NOTES_FIELD).value; event.getContent().setText(notes); alert(event.getContent().getText(notes)); alert(event.getHtmlLink().getHref()); event.updateEntry(handleSaveSuccess, handleSaveError); }; function handleSaveSuccess(entryRoot) { alert(entryRoot.entry.getTitle().getText()); var eventList = document.getElementById(EVENT_SELECT); var option = eventList.options[eventList.selectedIndex] option.text = entryRoot.entry.getTitle().getText(); var eventIndex = option.value; alert(eventIndex); myEventsFeed.getEntries()[eventIndex] = entryRoot.entry; setStatus("Saved") }; function setStatus(msg) { var eventStatus = document.getElementById(STATUS_AREA); if (msg) { eventStatus.innerHTML = msg; } else { eventStatus.innerHTML = ""; } }; function handleSaveError(e) { setStatus(e.message); handleError(e); }; function handleError(e) { if (e instanceof Error) { // Alert with the error line number, file and message. alert('Error at line ' + e.lineNumber + ' in ' + e.fileName + '\n' + 'Message: ' + e.message); // If available, output HTTP error code and status text if (e.cause) { var errorStatus = e.cause.status; var statusText = e.cause.statusText; alert('Root cause: HTTP error ' + errorStatus + ' with status text of: ' + statusText); } } else { alert(e.toString()); } }; function reset() { var saveButton = document.getElementById(SAVE_BUTTON); saveButton.disabled = true; var eventList = document.getElementById(EVENT_SELECT); eventList.options[0].disabled = false; eventList.options[0].text = "Waiting..."; while (eventList.length > 1) { eventList.remove(1); } eventList.disabled = true; document.getElementById(TITLE_FIELD).value = ""; document.getElementById(DATE_FIELD).value = ""; document.getElementById(LOCATION_FIELD).value = ""; var attendeesDiv = document.getElementById(ATTENDEES_FIELD); attendeesDiv.innerHTML = ""; document.getElementById(NOTES_FIELD).value = ""; }; </script> </head> <body> <table class="plain"> <tr> <td class="plain" style="width:460px;"> <table class="plain"> <tr id="default-pane" style="display:none"> <td class="plain" style="height:404px; width:460px; background-color: rgb(158,200,255); text-align:center; vertical- align:middle"> <input id="auth-button" type="button" value="Login" onclick="login()" style="margin:5px 0px 5px 0px;"/> </td> </div> <tr id="authenticated-pane" style="display:none"> <td class="plain" style="height:auto;background-color: rgb(158,200,255);text-align:center;"> <div id="dropdown"> List of Domain Calendars: <select id="cal-select" style="width:120px" disabled="disabled"> <option>Waiting...</option> </select> </div> <div id="EventsDropDown"> List of Selected Calendar Events: <select id="event-select" style="width:120px" disabled="disabled"> <option>Waiting...</option> </select> </div> <div id="event-table"> <table class="plain" style="background-color: rgb(195, 217, 255);margin: 5px 10px 0px 10px;padding: 5px 5px 5px 5px"> <tr> <td class="plain eventinfo">Title:</td> <td class="plain eventinfo"><input id="title- field" type="text" style="width:100%" onclick="setStatus();"/></td> </tr> <tr> <td class="plain eventinfo">Date:</td> <td class="plain eventinfo"><input id="date- field" type="text" style="width:100%" onclick="setStatus();"/></td> </tr> <tr> <td class="plain eventinfo">Location:</td> <td class="plain eventinfo"><input id="location- field" type="text" style="width:100%" onclick="setStatus();"/></td> </tr> <tr> <td class="plain eventinfo">Attendees:</td> <td class="plain eventinfo"><div id="attendees- field"></div></td> </tr> <tr> <td class="plain eventinfo" style="vertical- align:top">Notes:</td> <td class="plain eventinfo"><textarea id="notes- field" cols="40" rows="10" onclick="setStatus();"></textarea></td> </tr> <tr> <td class="plain eventinfo">Change Title to:</td> <td class="plain eventinfo"><input id="title-change" type="text" style="width:100%" onclick="setStatus();"/></td> </tr> </table> <input id="logout-button" type="button" value="Logout" onclick="logout()" style="float:left; margin:5px 0px 5px 0px;"/> <input id="save-button" type="button" value="Save to Google Calendar" onclick="saveEvent()" style="float:left; margin:5px 0px 5px 0px;"/> <input id="update-button" type="button" value="Update to Google Calendar" onclick="update_Event()" style="float:left; margin:15px 0px 15px 0px;"/> <div id="status-area" style="float:right; margin:5px 0px 5px 0px;"></div> </div> </td> </tr> </table> </td> </tr> </table> <img src="images/Logo_25wht.gif" /> </body> </html> </html> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
