Hi Everyone,

I'm going a bit loopy with this problem (first day with the API) -
pseudo code is:

Login/Authenticate as [email protected] google account.

Load list of calendars for [email protected] google account.

Select calendar to getEventsFeed (not default user). Check token,
token still active.

Error message saying "[email protected] does not have access to view this
calendar."

I'm definitely not logged in as [email protected] and if I turn on
Private Browsing I get an authentication error or bad URI on the
getEventsFeed call.  Can someone please tell me what I'm missing
here?  (I've also had visibility errors previously, but not getting
them now)



var EVENT_FEED_URL =
                                
"https://www.google.com/calendar/feeds/default/allcalendars/full";;

                        function init() {

                                var token = 
google.accounts.user.checkLogin(EVENT_FEED_URL);
                                calendarService = new
google.gdata.calendar.CalendarService('WORK_App');
                                var authButton = 
document.getElementById('auth_button');
                                if 
(google.accounts.user.checkLogin(EVENT_FEED_URL)) {
                                        authButton.value = 'Logout';
                                        // get a list of calendars
                                        
calendarService.getAllCalendarsFeed(EVENT_FEED_URL,
callbackGetCalendars, handleError);
                                } else {
                                        authButton.value = 'Login';
                                }
                        };

                        // Tells the google JS lib to call the init function 
once loaded
                        google.setOnLoadCallback(init)

                        /* LOADING CALENDARS */
                                var callbackGetCalendars = function(result) {
                                        // Obtain the array of Calendars
                                        var entries = result.feed.entry;
                                        console.log(result.feed.entry);
                                        for (var i = 0; i < entries.length; 
i++) {
                                                var calendarList = 
document.getElementById(CALENDAR_LIST);
                                                var calendarEntry = entries[i];
                                                var calendarTitle = 
calendarEntry.getTitle().getText();
                                                var calendarId = 
calendarEntry.getId().getValue();
                                                var option = 
document.createElement("option");
                                                option.value = calendarId;
                                                
option.appendChild(document.createTextNode(calendarTitle));
                                                
calendarList.appendChild(option);
                                        }
                                }
                        /* END OF LOADING CALENDARS */

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

                        function loadEvents(URI) {
//                              loginOrLogout();

                                if 
(google.accounts.user.checkLogin(EVENT_FEED_URL)) {

                                        var cleanURI = 
URI.replace('default/calendars/', '');
                                        cleanURI += '/private/full';
                                        //alert(cleanURI)

                                        // above not working, try hard coded..
                                        cleanURI = 
"https://www.google.com/calendar/feeds/
WORK.com_cpt5np6dspoug87rc08m9uaje4%40group.calendar.google.com/
private/full";
                                        calendarService.getEventsFeed(cleanURI, 
handleEventsFeed,
handleError);
                                }
                        }

Thanks for any help or suggestions; I'm totally stumped here.

-- 
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