How to get ics calendar invitation to automatically add to calendar - outlook

I am generating .ics calendar invitation with the node package ical-generator and sending the attachment in an email via mandrill.
The .ics calendar invite contains information for one event at a specific time and date.
example generated file:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//sebbo.net//ical-generator//EN
METHOD:REQUEST
NAME: xxxx Events
X-WR-CALNAME: xxxxx
BEGIN:VEVENT
UID:5wzd#xxx.com
SEQUENCE:0
DTSTAMP:20180318T202459Z
DTSTART:20180330T230000Z
DTEND:20180330T230000Z
SUMMARY:test
LOCATION:test
DESCRIPTION:test
ORGANIZER;CN="info":mailto:info#xxxx.com
END:VEVENT
END:VCALENDAR
Right now, the user receives the calendar invitation as an attachment in the email and is able to add the event to their calendar if they open up the attachment and click on "add to calendar" (in outlook).
What changes do I need to make so that the calendar invite is automatically parsed by the mail client and added to the user's calendar (similar functionality is found in email confirmation from sites like meetup and eventbrite).
Not sure I have the context knowledge around how email clients, calendar systems or .ics files work to have a framework of how to approach this problem
Any suggestions or pointers to resources is greatly appreciated! Thank you!

You need to consider three points in order to add events automatically:
Email Header
iCalendar Method
ATTENDEE information the "VEVENT" calendar component
Email Header
In order to get the email client to parse correctly the attached .ics file, you should add the scheduling method and MIME information to the email headers. This is specified by the iCalendar Message-Based Interoperability Protocol (RFC 2447).
For this reason, your header should include Content-Type,
Content-Transfer-Encoding and Content-Disposition as specified in the following example:
Content-Type: text/calendar; charset=utf-8; method=REQUEST; name=invite.ics'
Content-Transfer-Encoding: Base64
Content-Disposition: attachment; filename=invite.ics
iCalendar Method
When used in a MIME message entity, the value of "METHOD" must be the same as the Content-Type "method". This can only appear once within the iCalendar object. The value of this field is defined by the iCalendar Transport-Independent Interoperability Protocol (iTIP) (RFC 5546).
In order to request for a meeting, the value should be "REQUEST".
METHOD:REQUEST
ATTENDEE information the "VEVENT" calendar component
This property is the state of a particular "Attendee" relative to an event. It is used for scheduling and is defined by the "PARTSTAT" parameter in the "ATTENDEE" property for each attendee.
ATTENDEE;PARTSTAT=ACCEPTED;CN="Jane
Doe";EMAIL=jdoe#gmail.com:MAILTO:jdoe#gmailcom
Here is an example of a minimal .ics file:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
UID:<unique-id>#<site>.com
DTSTAMP:20210605T073803Z
DTSTART;TZID=America/Guayaquil:20210614T030000
DTEND;TZID=America/Guayaquil:20210614T040000
SUMMARY:My Event
ORGANIZER;CN="Juan Perez":mailto:jperez#organizer.com
ATTENDEE;PARTSTAT=ACCEPTED;CN="Jane
Doe";EMAIL=jdoe#gmail.com:MAILTO:jdoe#gmailcom
URL;VALUE=URI:https://<site>.com/event/5960492994476830083
END:VEVENT
END:VCALENDAR
For more details, please take a look at my gist.

You need two things to get this working:
1) The correct encoding of the attachment in your email, see this email headers:
Content-Disposition: attachment;
filename=meeting.ics
Content-class: urn:content-classes:calendarmessage
Content-Type: text/calendar;
name="meeting.ics";
component="VEVENT"
Content-Transfer-Encoding: 7bit
2) The correct format for the ics file. If you work in PHP to generate the ICS file you should use the library provided from icalendar.org
Try to use this event to test if working and use the validator present in the site mentioned above.
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ZContent.net//ZapCalLib 1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
SUMMARY:Simple Event
DTSTART:20200101T120000
DTEND:20200101T130000
UID:2020-02-12-11-02-23#demo.icalendar.org
DTSTAMP:20200212T100223
Description:This is a simple event\, using the Zap Calendar PHP library. Vi
sit http://icalendar.org to validate icalendar files.
END:VEVENT
END:VCALENDAR

The best you can do is ensure that the ics file is well setup, with the text/calendar header etc.
The providing system cannot force on the users device how the file is dealt with, it is entirely within the control of the receiver and their device setup.
For example I have my windows pc set to open ics files in a text editor, while my iphone will try to do an add to calendar (the icloud one), but I actually use google calendar. And Gmail used to not automatically add invites unless they'd been sent to the gmail address, whereas I use other domains for personal/family vs work, which all go to gmail. I'm not sure whether that is still a problem. I don't want the auto added.
Depending on the sort of system you developing for, You might want to consider having the recipients subscribe once to a personal ics url, rather than sending individual invites all the time. If subscribed, then future events/classes etc will automatically show up. I love it when systems do that, but too often they don't. EG: classes that one signs up individually for.

Related

Cancelled mail ics showing "not supported"

Canceled invitation emails send to outlook has an attachment "not supported". This is the ics i'm using for cancel email invitation. Could someone help me to understand what i'm missing here.
PS: Gmail is able to parse this ics and it is removing the event from calendar.
BEGIN:VCALENDAR
VERSION:2.0
METHOD:CANCEL
PRODID:-//PYVOBJECT//NONSGML Version 1//EN
BEGIN:VEVENT
UID:fwefgWuxV6DNc1#QnzyZWc38uhPXw2
DTSTART:20190709T084500Z
DTEND:20190709T094500Z
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=DECLINED:mailto:p
rhrsei#helonp.com
CREATED:20190709T082113Z
DESCRIPTION:\nanfirst anlast has can
celled this meeting.\n\n************************************************\n
\nMessage/Description: canceled \n\n\n************************************
************\n\nHelop Company\n
DTSTAMP:20190709T082204Z
LAST-MODIFIED:20190709T082205Z
LOCATION:
ORGANIZER:mailto:reiuhfoiwetransf#helonp.com
SEQUENCE:1
STATUS:CANCELLED
SUMMARY:asia singapaore
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
The above is working with an outlook exchange server, but it is failing on o365 desktop client and even in office web app.
I ran into a same issue recently and just figured out the solution.
Looks like Microsoft has updated how they valuate Ical emails.
So it's not the ICS file that's corrupted, but if you're sending out a cancellation, you'll probably have some header that may say method=REQUEST. This works on all platforms but looks like Microsoft is checking if this is method=CANCEL for cancellation emails.
If you have a header of method=REQUEST and your ICS file is meant to cancel a meeting, it will then be corrupt. You'll have to change it to method=CANCEL.
Hope that helps!

Outlook shows iCal date changed despite it being the same date

I'm generating iCal files and sending them via e-mail to the person that registered to a certain event on the intranet. This happens in an internal company network where everyone has to use MS Outlook, so I am mostly concerned that it looks correct on Outlook.
When the event on the intranet is changed, a new event invite with a current iCal is being sent to the registrant.
However, no matter what I change, the date keeps being highlighted as changed, despite the date being exactly the same as on the first iCal file.
Does anyone know why this happens?
I did try:
Increment the SEQUENCE number each time (first 0, then 1 and so on)
Set a custom (always the same) DTSTAMP
The event UID is exactly the same, proven by the fact that the existing event gets updated in Outlook
Note on the following screenshot that the location well has changed (and is also highlighted), but the date did not, but is still highlighted.
My iCal looks like this:
----__--MAILNEXTPART--__--
Content-Type: multipart/alternative; boundary="--__--MAILINNERBOUNDARY--__--"
----__--MAILINNERBOUNDARY--__--
Content-Type: text/calendar; charset="UTF-8"; method=REQUEST
Content-Transfer-Encoding: quoted-printable
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Outlook 14.0 MIMEDIR//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:icalevent-8315-108-2019-05-03T11:00:00-2019-05-03T13:00:00
DTSTART:20190503T110000Z
SEQUENCE:2
TRANSP:OPAQUE
STATUS:CONFIRMED
DTEND:20190503T130000Z
LOCATION:Another Company\, \nAnother Street\, \nCH-1000 Lausanne
SUMMARY:Testevent for Outlook calendar
ATTENDEE:event-registrant#domain.com
CLASS:PUBLIC
DESCRIPTION:This is the description.
ORGANIZER:organizer#domain.com
DTSTAMP:20190503T110000Z
END:VEVENT
END:VCALENDAR
----__--MAILINNERBOUNDARY--__----
----__--MAILNEXTPART--__----
Note that I did try in this one to set the DTSTAMP to the event start date/time but this had no effect on the behavior, even if it lies in the future.

Outlook doesn't send answer to event invitation via iCal

I am trying to send an invitation to an event in form of an iCal email attachment. I'm testing it with 3 clients: Zimbra, Gmail and Outlook. All three interpret the attachment correctly: They show the respective RSVP buttons (Accept/Tentative/Decline). However, after pressing the button, only Zimbra sends an email with an iCal file containing the answer. Gmail and Outlook don't.
Is this a normal behavior, or am I doing something wrong? I would expect the clients to send an email with an answer. Saving the data only to a local calendar doesn't make much sense to me.
Example of the iCal I am sending:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Calendar APP
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20180424T084322Z
DTSTART:20180424T000000
DTEND:20180424T235959
SUMMARY:e107
TZID:Europe/Vienna
LOCATION:Besprechungsraum 1
SEQUENCE:0
ORGANIZER:mailto:organizer#mail.com
UID:20180424T084322Z-confId=795:timeTableId=18997#fe80:0:0:0:e73:2050:cc3
d:6035%utun0
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=;PARTSTAT=NEEDS_ACTION;RSVP=TRUE:mailto:
user#mail.com
ATTENDEE;ROLE=REQ-PARTICIPANT;CN=;PARTSTAT=NEEDS_ACTION;RSVP=TRUE:mailto:
another_user#mail.com
END:VEVENT
END:VCALENDAR
Thank you in advance.
Not sure you're still looking for an answer on this but I do know (from learning the hard way) that if you send your test message from a gmail account but are answering on behalf of a DIFFERENT gmail account, then gmail will not send back a response. So if you're using testacct1#gmail to send a recipient (testacct2#gmail) on behalf of a THIRD acct (testacct3#gmail) gmail will not send the reply. Google checks the sender against the invitee. If they don't match, you will not get a response.

Getting a rsvp response from a created .ics file

I’m working on an OSX app where I want to create calendar events, add some attendees, add the event to the user Calendar, and send an invitation to the attendees. First I thought I could use the Eventkit framework, but for some reason you can’t add attendees to an event created by Eventkit. Instead I create an .ics file (see example below). I can add the .ics file to the Calendar and send it as an attachment in a mail as an invitation. The attendee can add it to his own Calendar and select accept in the rsvp section. However, the organizer never receives his acceptance. I have no idea how to get this to work and haven’t been able to locate any examples. Is this simply not possible or what am I doing wrong.
Any help is appreciated
BEGIN:VCALENDAR
PRODID:-//Org//App//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:20120920T150350Z-70#http://localhost/www/
CREATED:20140920T150350Z
DTSTAMP:20140921T080800Z
DTSTART:20140921T080800Z
DTEND:20140922T060800Z
DESCRIPTION:Attend this meeting
SUMMARY:Meeting invitation
LOCATION:The office
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEED-ACTION;RSVP=TRUE:mailto:attendee#mail.com
ORGANIZER;CN=organizerName:mailto:organizer#mail.com
LAST-MODIFIED:20140921T080800Z
PRIORITY:1
SEQUENCE:0
STATUS:CONFIRMED
TRANSP:TRANSPARENT
END:VEVENT
END:VCALENDAR
I too had the same issue. And now i found the solution.
This can be fixed by the line RSVP=TRUE,it seems you already added that.
So remove that ROLE and PARTSTAT in ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEED-ACTION;RSVP=TRUE:mailto:attendee#mail.com and make it as below.
ATTENDEE;RSVP=TRUE:mailto:attendee#mail.com
The above line is enough.
Your problem is due to a simple typo. You need ; instead of : between the parts.
Change:
RSVP=TRUE:mailto:attendee#mail.com
to
RSVP=TRUE;mailto:attendee#mail.com

ICS Email Attachment Not Working for Exchange Users

I am sending a meeting invitation as an email with an ICS attachment from a Java web application. Everything works fine when I send it to Outlook users who are not using an Exchange server. They get the appropriate Accept/Reject buttons and can add the meeting to their calendar.
Things are not working for users who are on an Exchange server, however. They get a meeting invite, but it lists themselves as the meeting organizer and they are unable to change any of the meeting details. They cannot accept or reject and cannot add it to their calendar.
It is almost like Exchange is altering or does not like the format of the ICS we are sending, but normal Outlook handles it just fine.
Here is the ICS we are sending. Does anyone know what we can change to make this work for Exchange users, in addition to Gmail and non-Exchange Outlook Users.
BEGIN:VCALENDAR
PRODID:-//fincrm//iCal4j 1.0//EN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
UID:128
DTSTAMP:20110927T191127Z
DTSTART;VALUE=DATE-TIME:20110928T082000
DTEND;VALUE=DATE-TIME:20110928T085000
ACTION:DISPLAY
DESCRIPTION:Time is set to 8:20 AM
SEQUENCE:0
ORGANIZER:MAILTO:user1#ltest.com
LOCATION:Financial CRM Application
ATTENDEE:MAILTO:user2#test2.com
SUMMARY:CRM Task #128
END:VEVENT
END:VCALENDAR
I appreciate your suggestions.
I have figured out that sending the ICS as a Multipart MIME Message seems to work with both Gmail and Exchange. Here is some of the relevant Java code ("calendar" is the ICS string)
// Create an alternative Multipart
Multipart mp = new MimeMultipart("alternative")
BodyPart textPart = new MimeBodyPart();
textPart.setText(eventDescription);
BodyPart calPart = new MimeBodyPart();
calPart.addHeader("content-class", "urn:content-classes:calendarmessage")
calPart.setContent(calendar.toString(), "text/calendar;method=REQUEST")
mp.addBodyPart(textPart);
mp.addBodyPart(calPart);
I know that the is from a while ago, but you can solve this with the registry fix found here:
http://support.microsoft.com/kb/944094
I have tested this with Outlook 2010 running on Exchange 2010 and this allowed 3rd party events to be entered into the calendar when you are the organizer.
I have found that if the organizer is set to you, then Outlook 2011 on Mac will not offer to add the meeting to your Calendar. Removing the Organizer from the meeting seems to work well enough.
I have also found that if the ICS attachment is not the last item attached to a multipart message, it will be stripped.

Resources