Hi all, I have a bunch of calendar data that I'm trying to upload using this script:
<!doctype> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" / > <title>Calendar uploader</title> <script type="text/javascript" src="http://www.google.com/jsapi"></ script> <script type="text/javascript" src="./diary10.js"></script> </head> <body> <div id="logger"></div> <img src="./avatar.jpg" /> <script type="text/javascript" language="javascript" charset="utf-8"> google.load("gdata", "1"); var CALID = '[email protected]', feed = 'http://www.google.com/calendar/feeds/' + CALID + '/ private/full', mike = { /* elided */ }; function logMeIn() { scope = "http://www.google.com/calendar/feeds/"; var token = google.accounts.user.login(scope); }; function setupMyService() { var myService = new google.gdata.calendar.CalendarService ('exampleCo-exampleApp-1'); logMeIn(); return myService; }; google.setOnLoadCallback(function() { window.index = 0; window.GCal = setupMyService(); GCal.getEventsFeed(feed, function(result) { window.Feed = result.feed; alert(Feed.getTitle().getText()); upload(index); }); }); //------------------------------------------------------------------- var update = function(n) { document.getElementById('logger').innerHTML = 'Uploaded ' + n + ' of ' + Diary.length + ' records'; }; var upload = function(n) { var event = Diary[n]; if (!event) return; var newEntry = new google.gdata.calendar.CalendarEventEntry({ authors: [mike], title: {type: 'text', text: event.description}, content: {type: 'text', text: ''}, locations: [], times: [{ startTime: google.gdata.DateTime.fromIso8601 (event.starttime), endTime: google.gdata.DateTime.fromIso8601 (event.endtime) }] }); Feed.insertEntry(newEntry, function() { index += 1; update(index); upload(index); }, function() { console.log(arguments); }); }; </script> </body> </html> It seems to log in okay and reads the title of the private feed fine ( alert(Feed.getTitle().getText()); ), but then when I try to insert entries it either redirects to the login page again or calls the error function ( console.log(arguments); ), saying authentication is required. This happens locally and when running on a public domain. I've read the docs over and over and can't get this to work, can someone please help out? Many thanks, James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
