How to Create HTML Link to Add Event to Calendar (Google, Outlook, Office 365, and Apple Mail)

Add to Calendar link allow to add an event to the calendar with prefilled info. The event details are prefilled based on the info given in the HTML link. Mostly, the Add to Calendar link is used in the email or web page to redirect users directly to the calendar. In this example, we will show you how to build an HTML link to add events to Google calendar as well as Outlook, Office 365, and Apple Mail.

Google Calendar Link

The following HTML link redirects to Google calendar with prefilled event details (title, description, location, start time, and end time).

<a href="https://calendar.google.com/calendar/render?action=TEMPLATE&text=My Event&details=Event description text&dates=20220305T103000/20220305T184500&location=New York City">Add to Google Calendar</a>

Parameters:
The following parameters can be used in the Google calendar link.

  • action – TEMPLATE (required)
  • text – Title of the event (URL encoded format).
  • details – Event details or description (URL encoded format).
  • dates – ISO date format (start_datetime/end_datetime)
  • location – Location of the event (URL encoded format).

Outlook.com and Office 365 Links

The following HTML link redirects to Outlook and Office 365 with prefilled event details (title, description, location, start time, and end time).

<a href="https://outlook.office.com/calendar/0/deeplink/compose?subject=My Event&body=Event description text&startdt=2022-03-05T10:30:00+00:00&enddt=2022-03-05T18:45:00+00:00&location=New York City&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent">Add to Outlook.com</a>

Parameters:
The following parameters can be used in the Outlook/Office365 calendar link.

  • path – /calendar/action/compose (required)
  • rru – addevent (required)
  • subject – Title of the event (URL encoded format).
  • body – Event details or description (URL encoded format).
  • startdt – Start date and time.
  • enddt – End date and time.
  • location – Location of the event (URL encoded format).

Apple Mail/Outlook Link

The ICS file is required to create links for Apple mail or Outlook desktop.

<a href="https://www.codexworld.com/newyork_event.ics">Apple Mail/Outlook Desktop</a>

3 Comments

  1. Gerd Said...
  2. Thiago Lenzi Said...
  3. Piyush Parihar Said...

Leave a reply

keyboard_double_arrow_up