Akonadi Resource for Microsoft Exchange Web Services (EWS)

Whether you are a Microsoft hater or a lover, when you have ever had a chance to work for a medium or large corporation, you have probably stumbled upon Microsoft Exchange mail server. While it can be made to talk to regular e-mail clients using standards such as IMAP, POP3 and SMTP, some corporate admins choose not to enable any of the standard mail protocols leaving the user with no choice other than to use Microsoft Outlook. Even if it is possible to use regular e-mail clients they will not be able to explore the full potential of Exchange, as it is not only a mail server but rather a groupware server which includes support for calendar, tasks, contacts and many more.

Why not talk to Exchange in its own language?

Exchange actually knows three of them:

  • MAPI
  • ActiveSync
  • Exchange Web Services (EWS)

MAPI was the primary way to communicate with Exchange until version 2007. It is now considered legacy and it’s for a good reason – it’s a complex protocol, not an easy one to work with. ActiveSync is focused towards mobile applications.

Exchange Web Services were introduced with Exchange 2007 and since then have become the new primary standard to communicate with Exchange.

There are not many e-mail clients that are able to use native Exchange protocols. Evolution is able to work with both MAPI and EWS, but the support is buggy. An extension exists for Thunderbird (ExQuilla), but it requires a license and also has some bugs.

The situation on the Akonadi front

Akonadi has so far seen support for two of the Exchange native protocols. A resource exists for MAPI (akonadi-exchange). It started off as a read-only resource to access the Global Address List and the calendar and has since evolved to allow retrieval of e-mail. Unfortunately because of MAPI complexness it is buggy and pulls it some Samba4 dependencies.

Another resource exists for ActiveSync. Unfortunately access to Exchange using this standard is often heavily restricted or even completely blocked by corporate admins due to security concerns.

Exchange Web Services

When I first started exploring Exchange Web Services I noticed that it is relatively easy to use and quite well documented by Microsoft itself (big thanks to the EU forcing MS to documents its standards). Given the lack of fully-featured Exchange support I have given it a try to develop an Akonadi resource that would use EWS in order to allow KDE PIM to access the full potential of Exchange.

After nearly six months of development the day has come to publish the initial release of this resource.

Current status

The initial version (0.8.0) focuses on e-mail support. It is possible to both send and receive e-mail without use of IMAP, POP3 or SMTP (yes, by default Outlook doesn’t send e-mail through SMTP, but uses the native protocol to do it). Full control over mailbox folder is also possible. You can copy, delete e-mail and manage all folders.

Once notable feature is server-side tag support. Thanks to Exchange support for custom properties it is possible to save Akonadi tags into Exchange so that they can be retrieved on another machine or after a system reinstall.

Support for other items is partial. Calendar is read-only – events are retrieved, reminders work, but there is no possibility to add, modify or delete events as well as invite attendees or respond to invitations from others.

Personal address book is also read-only. There is no support for the Global Address List and tasks.

Development of all the missing features will require more time and will be subject to subsequent releases. It is however worth to note that a number of changes will have to be introduced to Akonadi as in some cases it is based on assumptions, which are not true for Exchange.

Can I try it out?

Of course, you’re welcome to do so. The project is hosted on GitHub, where you can retrieve the latest bleeding edge state of development or – in case you prefer a stable solution – one of available releases (currently there is only one).

I have prepared packages for Fedora 23 and Ubuntu 16.04, but since I’m not a packaging expert please bare with me in case there are some issues.

Being a Gentoo user I have obviously prepared an overlay.

Note: While I have done my best to develop good quality software I am only a human and humans make mistakes. In this case mistakes could even cause your e-mail to be lost, so please use with caution.

Next steps

Once e-mail support is stable I intend to focus on calendar support, which should make the resource much more useful.

Apart from the resource itself I also intend to work on the KDE PIM packages itself in order to better integrate with the EWS resource. I already had to introduce some workarounds that I would like to get rid of.

In the long term I hope to make this resource part of KDE PIM so that people can use Exchange with it without the need to install any third-party software and rely on my poor packaging 😉


21 thoughts on “Akonadi Resource for Microsoft Exchange Web Services (EWS)

  1. I just tried the deb package for kubuntu 16.04

    In the very positive side, I can synch much faster than with the imap account and the whole thing is much more responsive now (Using the exchange account I could also workaround connection error messages that I was receiving every now and then).

    In the less positive side, sending emails via the exchange server didn’t work for me. In the meanwhile I workaround this by using the smtp server.

    Thanks for the good work!


  2. wow, wonderful news 🙂
    just one question though: will the gentoo overlay be available via layman?

    anyway, thx a lot for your effort!


  3. Correction wrt to previous comment:

    Sent email using exchange account actually worked although it arrived almost one hour and a half afterwards .The same email sent via smtp took about 1 minute.

    Any clue about this?


    1. Sending e-mail is a hack ATM. There is a separate MTA resource, which talks to the master resource.
      I have seen delays in outgoing mail, but it only occurred when sending messages with large attachments. However once KMail reported that the e-mail was sent successfully it was actually sent.
      If this problem can be reliably reproduced I’d encourage you to raise a bug on the GitHub project page and with the help of some additional information I’ll try to figure out what could be wrong.


  4. I found your git repository a while ago. Great to have another missing piece of kmail come into place.
    Thanks for your efforts.


  5. Pingback: Links 2/5/2016: Linux 4.6 RC6, DragonBox Pyra | Techrights

    1. My company uses Office 365 and Microsoft-hosted Exchange. I’ve been testing the EWS resource against it so that sounds like the answer to your question would be “Yes”


      1. In case it helps ubuntu users trying to do this, even using kubuntu 16.04 I found I first had to install:

        After some trial and error I found the necessary parameters for the Akonadi resource were (in my case) like this:
        email – as usual something like: name1.name2@xxxxxxx.yyy.zzz
        domain – same as in the e-mail address but in CAPITALS ie: XXXXXX,YYY.ZZZ
        EWS URL: https://outlook.office365.com/EWS/Exchange.asmx


  6. thanks a lot for this project! receiving email works nicely here. however, i can’t find a way to configure kmail to send mail through exchange – when setting up how to send mail, there is no option to select akonadi-ews … any hint how to do this?


    1. Sending messages through EWS is possible, however due to missing functionality in KMail this has to be done using a workaround. In KMail configuration, under send accounts you need to create a new account and on the list you should see the Exchange EWS type. When configuring the new account select the master Akonadi EWS account to which sent mail will be routed and it should work.


  7. Thank you! The academy I just was accepted to seems to be Micro$hit huggers.
    Is there a documentation on how to use this? I cant find information on which type of receiving e-mail server I should select in the list while adding the server.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s