+ Start a Discussion

Connection to google calendar api breaks

This is post is related to my previous post.

        What is happening here is, i am using google calendar api in my visual force page. when i connect to the google calendar for hosted domain using gdata's Authsubutil classes, I am able to login and get the GRANT Access and DENY ACESS page. There it is showing the return URL also perfect. but when i click on Grant Access button it is redirecting back and throwing a null object ref error. on lines related to google feeds and Calendar Service object creation. Or it simply says the visual force page used in Return URL simply does not exist. 


Please Help.


RON HESS: i hope you can understand my problem Please advise some solution. i am available on skype 'v2_srinivas'

I'm using google API and I'm expriencing some problems since yesterday, was everything working fine for you before? I'm getting an insufficient privileges error.
You are right. even this has worked for me on sandbox till yesterday after noon IST. From the evening i started experiencing problems. When i dig into the code and tested, The svn repository used by google has been update with some new files from past 2 or 3 days as well as they have modified some of the existing files. I am not sure whether this is the problem for my issues... any ideas?
Oh really? I wasn't aware of the update.  I'm experiencing this in sandbox as well (cs2). But are you getting the insufficient privilege error too?
Ron HessRon Hess

Those changes have nothing to do with web usage, the were a client login method, which you would not use.


not sure what is going on.


does it work for non hosted , regular google accounts and fail for domain accounts ?  that is strange.


Yes, you're right Ron.


My issue has something to do with some sharing rules, strange because it was working without any problems and I just started to have the issue. But definitely not related to the Google API. 




Yes ron  you are right. It has worked for for normal google for some time. Later i have only checked with hosted domain as this is my target. I will check with normal google account and update you again.

But it definitely not working for hosting domain account. Not sure what is the reason. All i have done is i have used the getRequestUrl method for hosting domains.


Hi Guys,


Was there any further follow up on this?  I've been hitting my head against the same wall for a while now - working fine for calendars using an @gmail.com identity, but the famed Null Pointer when trying to get the all calendars feed of a Google Apps for your Domain account...


Any help would be most greatfully appreciated!






Hi Simon,

             Sorry for that. As of my best knowledge, There is no way around to do using apex for hosted accounts. You have

to use a web server with .net or java. I have done it using .net.... That is build a webservice in .net which actually do the

google calendar stuff. and  called this webservice inside my salesforce classes. This way it works.


After deciding to press on I have had some success!


The reason that this is failing for many/most Google Apps for Your Domain (or Hosted Apps or Premier or whatever you want to call it) setups is that the security settings in the domain are set to enforce SSL (as per http://www.google.com/support/a/bin/answer.py?hl=en&answer=100181).


The AuthSub stuff works fine once you put in the hd=your.domain.com parameter to your token request.


However every URL involved from then on needs to be re-written as, despite opening a feed with a https URL, all constituent feeds have http URLs.  Obviously this means that some of the SFDC code package needs re-writing to achieve this, but by just text replacing http://www.google with https://www.google we've had pretty much complete success.  Sure the code isn't particularly pretty or portable, but it does work correctly (and very, very quickly).


Now when we editing our training workshop bookings via Sites, our corporate Calendar is updated immediately!






Message Edited by SimonP on 10-28-2009 09:14 PM
Message Edited by SimonP on 10-28-2009 09:15 PM