Konfekt / mutt-ical

answer/display ical invitations with mutt
MIT License
4 stars 1 forks source link

Tracker not updated after sending response #2

Open driesbenoit opened 4 months ago

driesbenoit commented 4 months ago

When accepting an invitation, the organizer receives the accept message via mail. For the organizer, the event tracker in the Teams/Outlook calendar now shows that I, invitee, accepted the invitation. However, in my own calendar on Teams/Outlook, my response is not updated (it remains in the default unknown/tentative state).

Tested with neomutt (using built-in imaps support, so no local maildir, i.e. no isync) and Teams/Outlook invitations. I also do not use msmtp for sending mail, but the built-in smtp in neomutt (i.e. my send command is neomutt -F ~/.myaccount.profile -H -)

Do others experience the same problem? Or ideas to solve this issue? Tnx!

Konfekt commented 4 months ago

However, in my own calendar on Teams/Outlook, my response is not updated (it remains in the default unknown/tentative state).

Yes, I've the same problem. I am not sure it was ever solved in https://github.com/marvinthepa/mutt-ical as https://github.com/marvinthepa/mutt-ical?tab=readme-ov-file#osx-users goes to lengths about opening it in iCal, so maybe Outlook event tracking was not a chief consideration. The ICS file is generated by https://github.com/py-vobject/vobject and looks lean, whereas that by Outlook adds entries such as

STATUS:CONFIRMED
SEQUENCE:1
LOCATION;LANGUAGE=en-US:Skype-Call
X-MICROSOFT-CDO-APPT-SEQUENCE:1
X-MICROSOFT-CDO-OWNERAPPTID:1042765800
X-MICROSOFT-CDO-BUSYSTATUS:BUSY
X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
X-MICROSOFT-CDO-IMPORTANCE:1
X-MICROSOFT-CDO-INSTTYPE:0
X-MICROSOFT-DONOTFORWARDMEETING:FALSE
X-MICROSOFT-DISALLOW-COUNTER:FALSE

which seem to be addable by ans.vevent.add(). I am not sure if these, and then which, entries suffice to update the response.

Here the fifth entry according to https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/7b1219be-5d50-46a6-9b96-c1e86745a243 does not seem to be easily attainable, but maybe https://github.com/py-vobject/vobject stands prepared

Konfekt commented 4 months ago

Not sure whether PRODID:Microsoft Exchange Server ... is also looked at. I tentatively added some of the more obvious flags, in the hope that it helps Microsoft Outlook to recognize the event

Konfekt commented 4 months ago

Adding these two did not change much on my end; are you sure that the own calendar is changed by the server, and not by the local Outlook client itself ?

driesbenoit commented 4 months ago

Also for me, the changes did not solve the issue. I also tried to email the response to my own email address as well as to the event organizer, but to no avail. I'm afraid the only possibility to make this work is via an Outlook API, which would require quite some development work (auth issues etc).

Konfekt commented 4 months ago

I also tried to email the response to my own email address

That's a good idea.

Which Vobject version were you using? I now switch to https://github.com/py-vobject/vobject in the hope of improvements.

Some other things are off comparing the Outlook response, for example, the latter has no ORGANIZER, but a CLASS. Also, the ATTENDEE; tag looks somewhat strange here, as the MAILTO: mail address is only given in the next line, instead of following the CN entry.

It would be helpful to know if you make similar observations.

Then there are other tags listed above, which could play a role, though don't seem like it. Finally, do you have an idea how X-MICROSOFT-CDO-OWNERAPPTID comes about?

I know little about Outlook APIs. In fact, the idea was to use a terminal email client instead.

Konfekt commented 4 months ago

Leaving here for inspiration; maybe the Exchange credentials can be inferred from mutt:

To reply to an ICS Outlook event and automatically add it to your Exchange calendar using a Python script on Linux, you can use the exchangelib library. This library provides a simple interface to interact with Microsoft Exchange servers.

  1. Install the exchangelib library:

    pip install exchangelib
  2. Parse the ICS file:

    Use the ics library to parse the ICS file and extract event details.

  3. Connect to the Exchange server:

    Use exchangelib to authenticate and connect to your Exchange server.

  4. Create and save the event:

    Use the extracted details to create a new event in your Exchange calendar.

from exchangelib import Credentials, Account, CalendarItem, EWSDateTime, EWSTimeZone
import ics

# Step 1: Parse the ICS file
with open('event.ics', 'r') as file:
    ics_content = file.read()

calendar = ics.Calendar(ics_content)
event = next(iter(calendar.events))

# Extract event details
subject = event.name
start = event.begin.datetime
end = event.end.datetime
location = event.location
description = event.description

# Step 2: Connect to the Exchange server
credentials = Credentials('your_email@example.com', 'your_password')
account = Account('your_email@example.com', credentials=credentials, autodiscover=True)

# Step 3: Create and save the event in your Exchange calendar
tz = EWSTimeZone.timezone('UTC')
start = EWSDateTime.from_datetime(start)
end = EWSDateTime.from_datetime(end)

calendar_item = CalendarItem(
    account=account,
    folder=account.calendar,
    subject=subject,
    start=start,
    end=end,
    location=location,
    body=description
)

calendar_item.save()

print("Event added to calendar successfully.")