How to receive iCalendar (.ics or .ical) meeting invitations from
outlook.office365.com, so that they can be parsed and added to a
calendar (such as remind + wyrd)?

I've searched long and hard for an answer, but haven't found any, so I
wonder if I'm just missing something really trivial.

I am using Mutt 1.5.22 with OfflineIMAP 6.5.5 on Fedora 20 (Heisenbug).

There are many scripts out there for parsing iCalendar messages into
formats that can be imported into calendars. This is *not* my problem.
My problem is that I'm not even receiving iCalendar messages, so I have
nothing to parse.

A meeting invitation arrives in my inbox as a base64 encoded text/html
message. It is *not* a multipart message and there are *no attachments*.
The body of the message contains a link to Microsoft Outlook Web
Access (OWA). Following the link doesn't seem to do anything except
take me to WebMail. The rest of the email body contains the description
of the meeting invitation.

I tried forwarding the invite and forwarding the invite as an
attachment, but neither of these affected the format of the message.

I inspected the headers of the message, but nothing stood out as being
important. I've copied them here, in case they mean something to
anyone:

    Received: from [...] by [...] with Microsoft SMTP Server (TLS) id
            [...] via Mailbox Transport; [timestamp]
    Received: from [...] by [...] with Microsoft SMTP Server (TLS) id
            [...]; [timestamp]
    Received: from [...] by [...] with Microsoft SMTP Server (TLS) id
            [...]; [timestamp]
    Received: from [...] by [...] with mapi id [...]; [timestamp]
    From: [meeting organiser]
    To: [meeting attendees]
    Subject: [meeting subject]
    Thread-Topic: [meeting subject]
    Thread-Index: [...]
    Sender: [sender on behalf of meeting organiser]
    Date: [timestamp]
    Message-ID: <[...]>
    Accept-Language: en-US
    Content-Language: en-US
    X-MS-Exchange-Organization-AuthAs: Internal
    X-MS-Exchange-Organization-AuthMechanism: 03
    X-MS-Exchange-Organization-AuthSource: [...]
    X-MS-Has-Attach:
    X-MS-Exchange-Organization-SCL: -1
    X-MS-TNEF-Correlator:
    Content-Type: text/html; charset="utf-8"
    Content-Transfer-Encoding: base64
    MIME-Version: 1.0

I also inspected the headers of the message in WebMail. There were
more headers (some related to tnef), but again, nothing seemed related
to calendars or invitations.

I compared the headers of a "meeting invite" with the headers of a
normal email. The only difference was that a normal email contains an
extra header: "X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply".

My .offlineimaprc's folderfilter is set to not sync the Calendar folder.
This is because every time OfflineIMAP tried to sync, it would run into
over a hundred instances of the same error when syncing the Calendar
folder: "ERROR: IMAP server 'remote' does not have a message with
UID '[...]'."

Using Python's imaplib to inspect the Calendar folder:
    >>> import imaplib
    >>> i = imaplib.IMAP4_SSL("outlook.office365.com", 993)
    >>> i.login("[email protected]", "PASSWORD")
    ('OK', ['LOGIN completed.'])
    >>> i.select("Calendar")
    ('OK', ['159'])
    >>> i.fetch(159, "(RFC822)")
    ('OK', [None])
    >>> i.fetch(159, "(RFC822)")

The second time I call fetch, it returns a message: "The server couldn't
retrieve the following message. The message hasn't been deleted. You
might be able to view it using either Outlook or Outlook Web App. You
can also contact the sender to find out what the message says."

In WebMail, I see that the Calendar folder (accessible via the
Calendar tab) has permissions for visibility *outside organization*.
It's currently set to "Not shared". Other options are "Availability
only", "Limited details", or "Full details". Setting the permissions
to "Full details" and then sending a meeting invitation to myself
didn't have any effect on the format of the meeting invite.

As a workaround for not receiving iCalendar message, I have Thunderbird
open with the Lightning add-on. Somehow, the Lightning add-on knows how
to receive meeting invitations.  The messages still show up as
text/html, but there's a link in the status bar. Clicking it opens a
prompt asking whether to deny or accept the invitation.

Anyone have any ideas why meeting invitations from Outlook 365 are
arriving as simple text/html messages rather than iCalendar messages?
Is there anything I can do? Copied below is my muttrc and offlinemaprc,
in case the problem lies there:

MUTT

ignore *
unignore from: to: cc: bcc: date: subject:
unhdr_order *
hdr_order from: to: cc: bcc: date: subject:
alternative_order text/plain text/enriched text/html
auto_view text/calendar
auto_view text/html
set alias_file="~/.mutt/aliases"
set beep_new=yes
set certificate_file="~/.mutt/certificates"
set crypt_use_gpgme=yes
set date_format="%b %d"
set fast_reply=yes
set folder="~/.mutt/mail/"
set forward_format="Fwd: %s"
set from="[...]"
set header_cache="~/.mutt/cache/headers"
set hide_thread_subject=no
set index_format="%Z %D %-20.20n (%4c) %s"
set mail_check=0
set mailcap_path="~/.mutt/mailcap"
set markers=no
set mbox_type=Maildir
set menu_scroll=yes
set message_cachedir="~/.mutt/cache/bodies"
set mime_forward=ask-yes
set pager_context=3
set pager_index_lines=11
set pager_stop=yes
set pgp_use_gpg_agent=yes
set postponed="+drafts"
set query_command="lbdbq '%s'"
set realname="[...]"
set record="+sent"
set send_charset="utf-8:us-ascii"
set sendmail="/usr/bin/msmtp -a work"
set sidebar_visible=yes
set sidebar_width=20
set signature="~/.mutt/sig"
set sleep_time=0
set sort=threads
set sort_aux=reverse-last-date-received
set spoolfile="+INBOX"
set text_flowed=yes  # also need to add setlocal fo+=aw to vimrc
set timeout=1
set tmpdir="~/.mutt/temp"
set use_envelope_from=yes
set user_agent=no
source ~/.mutt/colours
mailboxes +INBOX +drafts +sent +templates +search

OFFLINEIMAP

[general]
accounts = work
fsync = false
maxsyncaccounts = 1
pythonfile = ~/.mutt/offlineimap.py

[Account work]
autorefresh = 1
localrepository = local
remoterepository = remote
status_backend = sqlite
postsynchook = notmuch new

[Repository local]
localfolders = ~/.mutt/mail/
type = Maildir

[Repository remote]
cert_fingerprint = [...]
idlefolders = ['INBOX']
remotehost = outlook.office365.com
remotepasseval = get_pws()
remoteuser = [...]
ssl = yes
type = IMAP
folderfilter = lambda foldername: foldername not in [
    'Calendar',
    '/calendar',
    'Contacts',
    'drafts',
    'Journal',
    'Junk E-Mail',
    'Notes',
    'Outbox',
    'RSS Feeds',
    'Suggested Contacts',
    'Sync Issues',
    'Sync Issues.Conflicts',
    'Sync Issues.Local Failures',
    'Sync Issues.Server Failures',
    'Tasks']

Reply via email to