1

Is it possible to create a Calendar Event from a hyperlink the same way you can trigger an email to be created doing:

<a href="mailto:me@anydomainname.com">eMail Us</a>

I want to have a service that suggests a meeting time to the user of the service, and if the user chooses they could easily create a Calendar Event based on the time suggested by the service. Ideally the service would provide a hyperlink that when clicked would open Google Calendar or the scheduling tool the user uses, and it would auto-create an event at the time specified and with the title specified by the service, and the user could then adjust and save the event to the calendar from there.

1 Answers1

3

Unfortunately there's no official URI scheme for calendar events like there is for email (mailto:) or phone calls (tel:—widely implemented but still in RFC status).

You may still be able to accomplish what you're going for with .ics files, however! The iCalendar file format is a plain-text representation of event data that is used by most major calendar apps, like Google Calendar, Outlook, and the macOS Calendar.

They look like this:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:uid1@example.com
DTSTAMP:19970714T170000Z
ORGANIZER;CN=John Doe:MAILTO:john.doe@example.com
DTSTART:19970714T170000Z
DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR

You could try setting up your service to generate .ics files with the appropriate data and offer them to the user as a teensy download. Google Calendar in particular may have an API to help with this, or to directly import it and save those users a step.

Community
  • 1
  • 1
n18l
  • 375
  • 1
  • 3
  • 6
  • Thank you for the guidance. This is really helpful to know. If its helpful to others I found that there are some javascript packages that help you generate that .ics file such as https://www.npmjs.com/package/ics. Do you have a favorite ics javascript-based generator yourself @Infinimbal? – HelpMeStackOverflowMyOnlyHope Feb 15 '17 at 00:14
  • I don't have one in particular @HelpMeStackOverflowMyOnlyHope, as it's not something I've tried recently. The package you linked to certainly looks like it fits the bill though, and is probably what I would use in your situation! – n18l Feb 15 '17 at 17:13