title: Adding extended properties to a not-yet-created Google Calendar event
body: <p>I'm writing a Google Calendar add-on that needs to be able to add <a href="https://developers.google.com/calendar/api/guides/extended-properties" rel="nofollow noreferrer">extended properties</a> to a calendar event <strong>before</strong> it's actually created. This happens when you open the add-on in the Calendar UI and then click in the calendar view to create a new event:</p>
  <p><a href="https://i.stack.imgur.com/s72jF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s72jF.png" alt="Creating a new event in Google Calendar" /></a></p>
  <p>The <a href="https://developers.google.com/apps-script/manifest/calendar-addons#eventopentrigger" rel="nofollow noreferrer"><code>eventOpenTrigger</code></a> calls <code>onEventOpen</code> when this event is opened:</p>
  <pre class="lang-js prettyprint-override"><code>// main.gs
  
  function onEventOpen(e) {
    const calId = e.calendar.calendarId;
    const calEventId = e.calendar.id;
    // Surprisingly, `e.calendar.id` *always* looks like a valid ID,
    // even though `Calendar.Events.get` throws a 404 Not Found error.
    const calEvent = Calendar.Events.get(calId, calEventId);
    // `Calendar.Events.get` throws a 404 Not Found error when
    // the event is opened as in the above screenshot. It does *not*
    // throw when an *existing* event is opened and edited.
    Calendar.Events.patch({
      extendedProperties: {
        private: { hello: 'world' },
      },
    }, calId, calEventId);
    // ... return a card ...
  }
  </code></pre>
  <p>I considered creating a &quot;Calendar updated&quot; trigger, but its handler would not be able to return a card to show in the add-on UI, which is needed for this add-on. Is this something that is possible? Or is there an alternative strategy to adding extended properties to a Calendar event before it's created?</p>