AS3 library for Google Calendar (as3googlecalendarlib)

I created an AS3 library for Google Calendar API. This library has following features implemented.

  1. Authenticating to the Calendar service
  2. Retrieving calendar lists
  3. Retrieving all calendars
  4. Retrieving only calendars that a user owns
  5. Managing calendars
  6. Creating new calendars
  7. Updating existing calendars
  8. Deleting calendars
  9. Retrieving events for a specified date range
  10. Creating single-occurrence events
  11. Updating events
  12. Deleting events
  13. Reminders and Notifications

Please download the library from this URL http://as3googlecalendarlib.googlecode.com

All you have to do is to use the classes in the com.adobe.googlecalendar.services package to use any of the feature mentioned above.

This library still needs to be improved, in terms of adding more features, code cleanup, documentation and implementing any suggestions. I will try to complete this as soon as possible. :)

If you are interested in contributing to this library, please let me know. If you want to use this and want to know how to, leave a comment.

I am in process of creating an AIR application using this API, I will be posting soon. :)

37 Responses to “AS3 library for Google Calendar (as3googlecalendarlib)”

  1. Danilo Says:

    Nice idea. I will take a look.

  2. Thomas Says:

    Very cool, I’ll check it out!

  3. Murali Says:

    Good one :) It will be of great use for many of us.

  4. Charles Says:

    Hi Sujit, I would like to use your library, I have searched the provided google code link but I didn’t find any file to download. Can you provide a link to download it? Thanks.

  5. Tmobetta Says:

    I’m very interested in using your library and its functionality in my web app, but am brand new to Flex programming. Please explain how I can put into my app and make it work. thanks

  6. Sujit Reddy G Says:

    Hi Charles,

    Please download the code as explained in this URL http://code.google.com/p/as3googlecalendarlib/source/checkout

    Hope this helps.

  7. Sujit Reddy G Says:

    Hi Tmobetta,

    I am working on an AIR application which will use this API and will be posting that soon. Please download the API and look at the classes in com.adobe.googlecalendar.services package. Names of the functions are pretty straightforward. I will post sample ASAP :)

  8. Paolo Says:

    There’s a sample FLEX MXML application for this library ? Some help?
    Thanks

  9. Sujit Reddy G Says:

    Hi all,

    I am working on a sample application using this API .. I promise to post it by 16th Feb ….. :)

  10. mango Says:

    Hi, Thanks for writing the library. Are there any pointers for how to use it? I’m new to AS3/Flash/Flex and even a short explanation would be very useful.

  11. Paolo Says:

    Hi Sujit! We are waiting for a sample about your great library!!!! :) I’ve tried to use it into a Flex app but i get only security errors…

  12. Documentation for as3googlecalendarlib « Sujit Reddy G - The Evangelist Says:

    [...] as3googlecalendarlib documentation | Not finding much time to work on the as3googlecalendarlib (http://sujitreddyg.wordpress.com/2009/01/29/as3-library-for-google-calendar-as3googlecalendarlib/) or the sample application using the library. I managed to create a simple API documentation for [...]

  13. Paolo Says:

    Hi Sujit.
    The error is:
    RPC Fault – Security Error accessing url – Channel.security.error – Destination: DefaultHTTP

  14. Sujit Reddy G Says:

    Hi all,

    I posted API docs and code samples for this library. More details at the URL below. This library might not work with Flex application running on Flash Player on browsers, cause Authenticate headers are blocked by Flash Players unless domain (Google in this case) has a cross domain policy which allows Authenticate headers. Please develop AIR applications. AIR rocks :)

    http://sujitreddyg.wordpress.com/2009/02/19/documentation-for-as3googlecalendarlib/

    Thanks. :)

  15. Sujit Reddy G Says:

    Hi Paolo,

    This error shouldn’t be caused by this library. Please share the code to reproduce this. Send it to sujitreddy.g@gmail.com

    Thanks.

  16. Fahrudin Paljush Says:

    hi..
    when i try to add event to calendar(i try and when create new calendar, and when i try to load old) this error message
    Error #2032: Stream Error. URL: http://www.google.com/calendar/feeds/default/owncalendars/full

    Can you help me ?
    farko.p@gmail.com

  17. Sujit Reddy G Says:

    Hi Fahrudin,

    Please run the application in debug mode and find HTTP status code in the console and share that. I couldn’t understand what you are trying to do, please try sending the code to reproduce this to sujitreddy.g@gmail.com.

    Thank you.

  18. sudheer Says:

    hi,
    I’m getting same error. HTTP status code is 403.

  19. sudheer Says:

    INFORMATION : Sending authentication request
    INFORMATION : Authentication request sent
    INFORMATION : Authentication response recieved
    INFORMATION : Parsed response
    INFORMATION : Authentication successful
    DEBUG : Add calendar XML created
    DEBUG : Sent request to add calendar to this URL: http://www.google.com/calendar/feeds/default/owncalendars/full
    INFORMATION : Authentication response event dispatched
    DEBUG : HTTPStatus event for adding calendar invoked: 403
    DEBUG : Fault function of add calendar invokedError #2032: Stream Error. URL: http://www.google.com/calendar/feeds/default/owncalendars/full
    DEBUG : Dispatched GoogleCalendarServiceEvent.ADD_CALENDAR_FAULT event

  20. jimmi4u Says:

    Hi all,

    how do you use the authentication method? I can’t do it. I’ve generated an API key, and an OAuth Consumer Secret for the webpage, but when I try to run the code I get only this:
    INFORMATION : Sending authentication request
    INFORMATION : Authentication request sent
    DEBUG : Add calendar XML created
    DEBUG : Sent request to add calendar to this URL: http://www.google.com/calendar/feeds/default/owncalendars/full
    and than the creationComplete tells me that: source not found and a button to edit the lookup source and than it tells me something like sandbox security error:
    Error #2044: securityError unverarbeitet. text=Error #2170: Verletzung der Sicherheits-Sandbox: file:///Flex Builder 3/…/bin-debug/main.swf kann keine HTTP-Header an http://www.google.com/calendar/feeds/default/owncalendars/full senden.
    Here is the code taken from the code samples:

    public function onLoad():void
    {

    var calendar:GoogleCalendarVO = new GoogleCalendarVO();
    calendar.setTitle(“test”);
    calendar.setSummary(“calendar summary”);
    calendar.timeZone = “Europe/Vienna”; //only few are supported. Check GoogleCalendarVO class
    calendar.color = “#A32929″;
    calendar.hidden = false;
    calendar.addWhere(“Vienna”);

    var _authenticate:GoogleCalendarAuthenticator = new GoogleCalendarAuthenticator();
    _authenticate.addEventListener(GoogleCalendarAuthenticatorEvent.AUTHENTICATION_RESPONSE, doCalendar);
    _authenticate.addEventListener(GoogleCalendarAuthenticatorEvent.AUTHENTICATION_FAULT, errorEvent);

    _authenticate.authenticateUser(“user”, “pwd”, “API-key”);

    var _calendarService:GoogleCalendarService = new GoogleCalendarService();
    _calendarService.addEventListener(GoogleCalendarServiceEvent.ADD_CALENDAR_FAULT,handleAddCalendar);
    _calendarService.addEventListener(GoogleCalendarServiceEvent.ADD_CALENDAR_RESPONSE,handleAddCalendar);

    var user:GoogleCalendarUserVO = new GoogleCalendarUserVO();
    user.userName = “user”;
    user.userPassword = “pwd”;
    user.authenticationToken =”Token taken from the oath-authentication when testing on google”;

    var cal:GoogleCalendarVO = new GoogleCalendarVO();
    if(cal != null)
    {
    _calendarService.addCalendar(cal, user);
    }
    }
    what am I doing rong?
    please help.
    Thank you.
    jimmi4u

  21. sudheer Says:

    hi,
    i’m using this project in an air application.
    it authenticates successfully but when adding the calendar i get the following error:
    DEBUG : HTTPStatus event for adding calendar invoked: 403
    DEBUG : Fault function of add calendar invokedError #2032: Stream Error. URL: http://www.google.com/calendar/feeds/default/owncalendars/full
    DEBUG : Dispatched GoogleCalendarServiceEvent.ADD_CALENDAR_FAULT event

  22. Sujit Reddy G Says:

    Hi Sudhir,

    Google calendar server is throwing this error when a API is invoked for a first time from a system. I haven’t found anything fault in the library, still trying to figure out reason for this. Kindly let me know if this problem is occurring every time.

    Hope this helps.

  23. Sujit Reddy G Says:

    Hi Jimmi,

    Please find below sample on how to send authentication request.

    Sending authentication request.

    calendarAuthenticator.addEventListener(GoogleCalendarAuthenticatorEvent.AUTHENTICATION_RESPONSE,
    handleAuthenticationResponse);
    calendarAuthenticator.addEventListener(GoogleCalendarAuthenticatorEvent.AUTHENTICATION_FAULT,
    handleAuthenticationResponse);
    calendarAuthenticator.authenticateUser(userName,userPassword);

    Getting authenticated GoogleCalendarUserVO object. You should use the authenticationToken in the object instance below.
    private function handleAuthenticationResponse(event:GoogleCalendarAuthenticatorEvent):void
    {
    var userObj:GoogleCalendarUserVO;
    userObj = event.authenticatedUser;
    }

    Hope this helps.

    I am sorry I cannot find time to document. :(

  24. sudheer Says:

    yes this error happens everytime. can’t find any problem with the code

  25. rsoares Says:

    Hi all!

    I want to use this library and want to know how.

    Thank you :)

  26. Gireesh Says:

    is there any sample project posted??

    thanks
    Gireesh

  27. I Singh Says:

    Is your lib not working with Flash AS3.0?

  28. Rahul Says:

    Hi,

    I am facing problem while retrieving events for a single day. the request doesn’t return anything in the response. But in case I change the duration from a single day to a month, then all those events are shown. Any idea where I might b wrong?

    Thanks

  29. chandra Says:

    Hi,

    I am facing problem whiel updating the event.
    from flash app to googlecalendar API. problem is
    i am updating the event as googlecalendareventvo
    in that
    what,when,where,calendar,descrition are the fields to update. but when i pass startdatetime and enddatetime to when i am getting error like null object reference.

    pls let me know if u have idea how to update event in calendar using flash as3

  30. I Singh Says:

    It is not working for simple flash app. I think that need google cal webased authentication. Any Idea to implement it in flash.

  31. Sujit Reddy G Says:

    Hi Rahul,

    Not sure. Please try sharing the code to reproduce this. I can see if I can find the problem. Thanks.

  32. I Singh Says:

    Can you please modify this API for flash , now it is working only for AIR app.

    Thanks in advance.

  33. Sujit Reddy G Says:

    Hi I Singh,

    I don’t think Google has crossdomain policy files on their servers yet.

  34. I Singh Says:

    Any other solution for it.

  35. liutenantdan Says:

    Hi. I’m running your code in an AIR application. When I run the authentication, the response comes back twice. The only listener involved is the following:

    “var token:AsyncToken = authenticationService.send(params);
    token.addResponder(new Responder(handleAuthenticationResult, handleAuthenticationFault));”

    Is there a reason why the response handler is firing twice? The send() call is not duplicated anywhere, so I’m kinda lost on this one…

  36. liutenantdan Says:

    GOT IT..

    appears to be a bug in 3.4

    apparently it’s been fixed for 3.5

    :D

  37. LKW Says:

    Hi
    I want to use this library. May I have a copy? Thank you

Leave a Reply