A simple one-way calendar integration for Alfresco Share

Photo credit: Dafne Cholet
Photo credit: Dafne Cholet

A common request is to integrate the Alfresco Share calendar with an external calendaring system such as Outlook, Google Calendar, or Zimbra. Without an integration, people end up doing double-entry. You’ve already got a calendar that works pretty well. Why make people re-enter events in Alfresco Share?

Most people use Alfresco Share for team collaboration. The calendar doesn’t need to show everything on everyone’s calendar–that job is better left to the existing calendar server. What makes more sense is to show a few team-related events or milestones on the team’s Alfresco Share site calendar or maybe in a dashlet on the site’s dashboard.

When thinking about the problem, I realized that the calendar in Share is just another interested party in an event. Just as some calendaring systems allow you to “invite” a conference room to a meeting which effectively reserves that room for the meeting, you ought to be able to “invite” a Share site and have the Share site add that event to its calendar and update it when the event changes.

Treating the Share site as just another invitee is a non-invasive way to integrate with the calendaring system and it has the added benefit that only events in which the Share site was specifically invited will show up on the Share site calendar.

As luck would have it, the pieces to make this work already exist and they don’t require any changes to the source calendaring system. Check it out:

  • When you invite someone to a calendar event the calendaring system sends an iCalendar (.ICS) file as an email attachment to the invitee. The invitee’s email or calendaring client recognizes that attachment and updates the calendar accordingly.
  • There’s a Java library called iCal4j that knows how to parse iCalendar files. Yea for standards!
  • Alfresco supports receiving inbound email and you can easily bind custom logic to the creation of nodes. Alfresco creates one document for the email body and one for the ICS file attachment.
  • Events that show up on the Alfresco Share calendar are just content-less objects–they are instances of ia:calendarEvent.

Put those pieces together and a simple one-way calendar integration is born. The integration watches for incoming email with ICS attachments, parses the attachment, then creates, updates, or deletes the corresponding Alfresco Share site calendar object.

With this in place, all you have to do to add an event to the Alfresco Share site calendar is invite the Share site to the event from your favorite calendaring system.

But what’s the invitee name of a Share site? Great question! In Alfresco, there’s an aspect called email alias. You can add it to any folder and give it an arbitrary value. Then, when sending email to Alfresco you can specify the alias.

My integration includes code that makes sure all Share sites have a folder that can be used to store inbound email and it gives that folder an alias equal to the Share site’s short name (which is used as part of the Share URL). So if your Share site is called “test-site-1” and you normally send email to Alfresco via alfresco.someco.com, your Share site’s email address becomes test-site-1@alfresco.someco.com.

What about updates? Calendar systems have a universal identifier for every event. When calendar entries are updated or deleted, the calendaring system sends an iCalendar file just as it does for new events. Included in that file is the event’s unique ID and a flag that indicates whether the event is being created or deleted. When the integration creates the event in the Alfresco Share calendar, it stores the unique ID in the Alfresco object’s metadata which it can use later to match up subsequent update and delete requests.

How about a demo?

This video shows the integration in action. Be sure to make it full screen and select “HD”.

(If you can’t see the video, watch it on YouTube here).

What’s left to do?

This is a simple, one-way integration. It does not tell the corporate calendaring system which sites are available and it does not do a free-busy lookup. It also does not acknowledge the invitation back to the source calendaring system. I don’t consider these to be critical gaps but those features might make the integration tighter.

As a side-note, the automatic creation of an email alias for a Share site and a corresponding folder to hold inbound email (which users could then configure rules for) might be useful as a separate add-on even if you don’t need calendar integration. If you agree, let me know. Maybe the integration ought to be split into two separate AMPs.

Pull requests welcome

As usual, I welcome your participation on this project. If you find problems, fix problems, or want to make improvements, use the github project to create issues and pull requests.

9 comments

  1. Axel Faust says:

    Well, a logical feature would be to invite people to a calendar entry in Alfresco Share and use the OutboundSMTP system to send the ical invites. The InboundSMTP system should then be enhanced to handle responses (also ical I believe) to track the response status for the participants.
    I think free/busy lookup usually is only supported in those shared corporate setups. I have not yet seen any mail client issue/support ical-based free/busy requests for external parties.

  2. Jeff Potts says:

    Yes, that could be done. My philosophy was to have the Share calendar be read-only to keep it simple (not really read-only, but not sending anything back to the corporate calendaring system). No one’s going to use that calendar as their primary calendar client. And even to schedule one-off events, you probably want the full features and integration of your corporate calendar client.

  3. Great idea Jeff, adds a nice piece of functionality to allow calendars in share to be used as part of the large org.
    Would it be possible to add the email alias to the calendar itself (assuming it is a folder) and then update the site details with the email alias for the calendar.

  4. Jeff Potts says:

    Yes, the Share calendar objects are stored in a folder beneath the root site folder, so you can give it an alias. However, calendar events are persisted as “content-less” objects in that folder–Alfresco has its own set of calendar event metadata that describes each event. So putting the email and ICS file directly in that folder would be messy because that folder would be a mix of Alfresco-managed event objects and objects Alfresco does not know anything about (email and attachments). My integration parses the ICS file and translates that into Alfresco calendar events. I’ve chosen to create an “inbound invites” folder as a sibling to the calendar folder to hold the raw email and file attachments until they are processed.

  5. Felipe says:

    Hello Jeff!
    Before anything else, thank you very much by this amp. I’m new in Alfresco and related to your amp I’ve only one question: what about the current (old) sites created before the amp installation?

    The amp is working very well for new sites, but not for the current ones.

    I’ll apreciate a lot any advise to understand how to resolve this issue.

    Kind Regards,
    Felipe.

  6. Jeff Potts says:

    You are welcome, I am glad it is helpful.

    Try editing the site details. That may trigger the site folder to update which will cause the alias to be created as well as the folder where it processes emails.

    If that does not work, you can use the Repository view to navigate to Company Home/Sites/some-new-site and see that the inboundInvites folder that is adjacent to the documentLibrary folder. And, if you look at the properties of that folder you should see the email alias. You can use those as examples to manually create the same setup in existing sites.

    But, hopefully, simply editing a site’s details will do it.

  7. Felipe says:

    Dear Jeff.

    Editing the site details resolved the issue. Thank you very much!

    Before to ask you, I’ve been trying to create the inboundInvites folder manually, but when I sent the calendar invitation it’s received by the Site, no problem, but this is not processed in the calendar itself. The sub folder “processed” is not automatically created and the files of the calendar appointent are stored directly in the “inboundinvites” folder. Now, with your advice of “editing site details” everything with the amp is working very well.

    The other importante issue that I experimented, it’s the point of uncheck the support for Outlook when we are sending the calendar appointment. Otherwise, the message arrive but it’s not published in the site’s calendar because the ics file is missing.

    Only for the records: I’m using Alfresco Community 5.2 (General Release 201701).

    Thank you again by your valuable contribuition.
    Kind Regards,

    Felipe.

  8. Diwakar says:

    After installing the .amp module,every thing seems to work fine but add event calendar form still remains the same.

  9. Jeff Potts says:

    Yes, that is correct. This add-on does nothing to change the out-of-the-box event calendar form. Instead, this add-on makes it possible to invite Share sites to calendar events using your existing third-party calendar tools.

Comments are closed.