Create Calendar Event, Failure on Form Submit
<p>I have the code below which I have written and on Form Submit, will create a calendar event to the parameters. However I always get a failure that comes back via email:</p>

<p>TypeError: Cannot find function createEvent in object Calendar. (line 59, file "Create Event"). It's failing to find the Calendar, I have tried this by CalendarID and CalendarName.</p>

<p>Any assistance would be grateful.</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function CreateEvent(e) {

  var Group = e.values[1];
  var startTime = e.values[2];
  var endTime = e.values[3];
  var Activitytitle = e.values[4];
  var Actlocation = e.values[5];
  var ActivityDesc = e.values[6];
  var AuthLeader = e.values[7];
  var AuthLeaderNo = e.values[8];
  var AuthLeaderPermit = e.values[9];
  var LeaderCharge = e.values[10];
  var LeaderChargeNo = e.values[11];
  var LeaderEmail = e.values[12];
  var Adults = e.values[13];
  var Beavers = e.values[14];
  var Cubs = e.values[15];
  var Scouts = e.values[16];
  var Explorers = e.values[17];
  var Other = e.values[18];
  var InTouchName = e.values[19];
  var InTouchContact = e.values[20];
  var ManagerEmail = e.values[21];
  var RA = e.values[22];
  var Rules = e.values[23];
  
  var title = "(Pending) " + Activitytitle;
  
  var Actdescription = "&lt;h2&gt;Activity Information&lt;/h2&gt;" +
  "&lt;b&gt;Group:&lt;/b&gt; "  + Group + " &lt;br/&gt;" +
  "&lt;b&gt;Type of Activity:&lt;/b&gt; " + Activitytitle + " &lt;br/&gt;" +
  "&lt;b&gt;Activity Date Start:&lt;/b&gt; " + startTime + " &lt;br/&gt;" +
  "&lt;b&gt;Activity Date End:&lt;/b&gt; " + endTime + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;b&gt;Location:&lt;/b&gt; " + Actlocation + " &lt;br/&gt;" +
  "&lt;b&gt;Brief Description of Activity:&lt;/b&gt; " + ActivityDesc + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;h2&gt;Adventurous Activities Permit Information&lt;/h2&gt;" +
  "&lt;b&gt;Authorised Leader:&lt;/b&gt; " + AuthLeader +" &lt;br/&gt;" +
  "&lt;b&gt;Authorised Leader Contact Number:&lt;/b&gt; " + AuthLeaderNo + " &lt;br/&gt;" +
  "&lt;b&gt;Permit Details:&lt;/b&gt; " + AuthLeaderPermit + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;h2&gt;Attendance Details&lt;/h2&gt;" +
  "&lt;b&gt;Leader in Charge:&lt;/b&gt; " + LeaderCharge + " &lt;br/&gt;" +
  "&lt;b&gt;Leader Contact Number:&lt;/b&gt; " + LeaderChargeNo + " &lt;br/&gt;" +
  "&lt;b&gt;Leader Email&lt;/b&gt;: " + LeaderEmail + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;b&gt;Number of Adults (18+):&lt;/b&gt; " + Adults + " &lt;br/&gt;" +
  "&lt;b&gt;Non Uniform YP (Under 18):&lt;/b&gt; " + Other + " &lt;br/&gt;" +
  "&lt;b&gt;Number of Beavers:&lt;/b&gt; " + Beavers + " &lt;br/&gt;" +
  "&lt;b&gt;Number of Cubs:&lt;/b&gt; " + Cubs + " &lt;br/&gt;" +
  "&lt;b&gt;Number of Scouts:&lt;/b&gt; " + Scouts + " &lt;br/&gt;" +
  "&lt;b&gt;Number of Explorers/Young Leaders:&lt;/b&gt; " + Explorers + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;h2&gt;Health and Safety Information&lt;/h2&gt;" +
  "&lt;b&gt;Line Managers Email Address:&lt;/b&gt; " + ManagerEmail + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;b&gt;InTouch Contact:&lt;/b&gt; " + InTouchName + " &lt;br/&gt;" +
  "&lt;b&gt;InTouch Contact Number:&lt;/b&gt; " + InTouchContact + " &lt;br/&gt;" + " &lt;br/&gt;" +
  "&lt;b&gt;Risk Assessment Completed:&lt;/b&gt; " + RA + " &lt;br/&gt;" +
  "&lt;b&gt;Scout Association POR Guidelines Followed:&lt;/b&gt; " + Rules;
  
  var myCal = CalendarApp.getCalendarsByName('Activity Notifications');
  Logger.log('Found %s matching calendars.', calendars.length);
  
  myCal.createEvent (title, startTime, endTime, {
    description : Actdescription,
    location : Actlocation
  });
  
}</code></pre>
</div>
</div>
</p>