Google Calendar Connector
Documentation
Version: 5
Documentation

Google Calendar Connector - Source Code


<?xml version="1.0" encoding="utf-8"?>
<ApiConfig Name="Google Calendar"
           Desc="Read / write Google Calendar data inside your app; perform many Google Calendar operations without coding, just using easy to use high performance API Connector for Google Calendar"
           Slug="google-calendar-connector"
           Id="4ebd0208-8328-5d69-8c44-ec50939c0967"
           Logo="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBaRXhpZgAATU0AKgAAAAgABQMBAAUAAAABAAAASgMDAAEAAAABAAAAAFEQAAEAAAABAQAAAFERAAQAAAABAAAOw1ESAAQAAAABAAAOwwAAAAAAAYagAACxj//bAEMACAYGBwYFCAcHBwkJCAoMFA0MCwsMGRITDxQdGh8eHRocHCAkLicgIiwjHBwoNyksMDE0NDQfJzk9ODI8LjM0Mv/bAEMBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAMgAyAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZ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jyw1m/w82Gq6rc6xefabnYGChFVBgKB/wDXJP41Roor00klZHxU5ynJyk7thRRRTJN3QdebTnFvcEtaMfqYz6j29R+P17O2vLa8TdbTxyjAJ2tkjPTI7fjRRXs5ZiajfsnseXj6EEvaLcnooor2zyQrrfAX/IRuv+uQ/nRRXi8R/wDIrren6o9HKv8AfKfr+h3tFFFfjZ96FFFFABRRRQAUUUUAFFFFABRRRQAVwPxF1S30oxTzyIGELGOMtgyEHoPxI+maKK9HKoqWKimUq0qKlUjukzwjU9SuNWvmurjG9gAFXO1QOwyTj1+pNU6KK+4SSVkfNznKcnKTu2FFFFMkKKKKAP/Z"
           Version="5"
           EngineVersion="4"
           >
  <VersionHistory>
    <Change Date="2024-06-05" Type="New">Added Redirect URL property to support Web Application credentials (visible when show advanced option checked)</Change>
    <Change Type="Modified" Date="2022-10-13">Added retry logic on error code 429 (Too many requests).</Change>
    <Change Date="2021-11-26">Initial version</Change>
  </VersionHistory>

  <ServiceUrls>
    <ServiceUrl Name="Google Calendar API v3" Url="https://www.googleapis.com/calendar/v3/" />
  </ServiceUrls>
  <Auths>
    <Auth Name="OAuth" Label="User Account" HelpLink="https://zappysys.com/links/?id=10002"
          Type="OAuth" ConnStr="Provider=Google;ScopeSeparator={space};"
          TestEndPoint="list_calendars"
      >
      <Notes>
        <![CDATA[
        <p>To make this work you will have to create an OAuth application. To register an App, perform the following steps (Detailed steps found in the help link at the end):<p />
<ol>
  <li>Go to <a target="_blank" href="https://console.developers.google.com/">Google API Console</a></li>
  <li>From the Project Dropdown (usually found at the top bar) click Select Project</li>
  <li>On Project Propup click <b>CREATE PROJECT</b></li>
  <li>Once project is created you can click Select Project to switch the context (You can click on Notification link or Choose from Top Dropdown)</b></li>
  <li>Click <b>ENABLE APIS AND SERVICES</b></li>
  <li>Now we need to enable Google Drive API.</li>
  <li>Search <b>Google Drive API</b>. Select and click <b>ENABLE</b></li>
  <li>Go to back to main screen of <a target="_blank" href="https://console.developers.google.com/">Google API Console</a></li>
  <li>Click <b>OAuth Concent Screen</b> Tab. Enter necessary details and Save.</li>
  <li>Click <b>Credentials Tab</b></li>
  <li>Click <b>CREATE CREDENTIALS</b> (some where in topbar) and select <b>OAuth Client ID</b> option.</li>
  <li>When prompted Select Application Type as <b>Desktop App</b> and click Create to receive your ClientID and Secret. Later on you can use this information now to configure Connection with UseCustomApp=true.</li>
  <li>Go to <b>OAuth Consent Screen</b> tab. Under Publishing Status click <b>PUBLISH APP</b> to ensure your refresh token doesnt expire often. If you planning to use App for Private use then do not have to worry about Verification Status after Publish.</li>
</ol>
        ]]>
      </Notes>
      <Params>
        <Param Name="UseCustomApp" Value="True" Required="True" Hidden="False" Desc="Use your own app credentials or inbuilt app provided by ZappySys for ease of use. If you choose UseCustomApp=true then make sure to obtain your own ClientId and Secret using steps provided (Click [Steps to Configure] link found next to Authentication Type dropdown)" />
        <Param Name="ClientId" VisibleIf="UseCustomApp" RequiredIf="UseCustomApp"/>
        <Param Name="ClientSecret" Secret="True" VisibleIf="UseCustomApp" RequiredIf="UseCustomApp" />
        <Param Name="Scope" Value="https://www.googleapis.com/auth/calendar" />
        <Param Name="RetryMode" Value="RetryWhenStatusCodeMatch" Options="None;RetryAny;RetryWhenStatusCodeMatch;" Hidden="True" />
        <Param Name="RetryStatusCodeList" Value="403|429" Hidden="True" />
        <Param Name="RetryCountMax" Value="5" Hidden="True" />
        <Param Name="RetryMultiplyWaitTime" Value="True" Hidden="True" />  
        <Param Name="ReturnUrl" Label="Redirect URL (Only for Web App)" Options=";https://zappysys.com/oauth/" VisibleIf="UseCustomApp" Desc="Only specifiy this if you have created Credential as Web Application rather than Desktop. In Desktop App you dont have to supply Return URL (its always localhost). When you keep this blank it uses default value http://localhost:[some_random_port_each_time] for redirect_url)"  />
      </Params>
    </Auth>

    <Auth Name="ServiceAccount" Label="Service Account (Using Private Key File)" HelpLink="https://cloud.google.com/docs/authentication/production#create_service_account"
        Type="OAuth" ConnStr="Provider=Google;UseCustomApp=True;UseClientCertificate=True;CertificateStorageType=PfxFile;CertificatePath=[$PrivateKeyPath$];GrantType=ClientCredentials;"
        TestEndPoint="list_calendars"
  >
      <Params>
        <Param Name="ClientId" Label="Service Account Email" Desc="This is service account email ID (e.g. some_name@my_project.iam.gserviceaccount.com)" Required="True" />
        <Param Name="PrivateKeyPath" Label="Service Account Private Key Path (i.e. *.p12)" Desc="File path for p12 file (i.e. Private Key file for service account). Keep this key file secure" Required="True" />
        <Param Name="Scope" Value="https://www.googleapis.com/auth/calendar" />
        <Param Name="RetryMode" Value="RetryWhenStatusCodeMatch" Options="None;RetryAny;RetryWhenStatusCodeMatch;" Hidden="True" />
        <Param Name="RetryStatusCodeList" Value="403|429" Hidden="True" />
        <Param Name="RetryCountMax" Value="5" Hidden="True" />
        <Param Name="RetryMultiplyWaitTime" Value="True" Hidden="True" />   
      </Params>

      <Notes>
        <![CDATA[Use these steps to authenticate as service account rather than Google / GSuite User. Learn more about service account <a href="https://cloud.google.com/iam/docs/service-accounts" target="_blank">here</a><p />
Basically to call Google API as Service account we need to perform following steps listed in 3 sections (Detailed steps found in the help link at the end)<p />
<h3>Create Project</h3>
First thing is create a Project so we can call Google API. Skip this section if you already have Project (Go to next section)
<ol>
  <li>Go to <a target="_blank" href="https://console.developers.google.com/">Google API Console</a>
  <li>From the Project Dropdown (usually found at the top bar) click Select Project</li>
  <li>On Project Propup click <b>CREATE PROJECT</b></li>
  <li>Once project is created you can click Select Project to switch the context (You can click on Notification link or Choose from Top Dropdown)</b></li>
  <li>Click <b>ENABLE APIS AND SERVICES</b></li>
  <li>Now we need to enable API - Google Calendar API</li>
  <li>Search <b>Drive</b>. Select and click <b>ENABLE</b></li>
</ol>

<h3>Create Service Account</h3> 
Once Project is created and APIs are enabled we can now create a service account under that project. Service account has its ID which looks like some email ID (not to confuse with Google /Gmail email ID)
<ol>
  <li>Go to <a target="_blank" href="https://console.cloud.google.com/projectselector/iam-admin/serviceaccounts/create?supportedpurview=project/">Create Service Account</a>
  <li>From the Project Dropdown (usually found at the top bar) click Select Project</li>
  <li>Enter <b>Service account name</b> and <b>Service account description</b></li>
  <li>For Role, do not select anything for now and Click <b>Continue</b> and then click <b>Done</b>. Next we will create Key.</li>
</ol>

<h3>Create Key</h3>
Once service account is created we need to create key file (i.e. credentials).
<ol>
  <li>In the Cloud Console, click the email address for the service account that you created.</li>
  <li>Click <b>Keys</b>.</li>
  <li>Click <b>Add key</b>, then click <b>Create new key</b>.</li>
  <li>Click <b>Create</b> and select <b>P12</b> format. A <b>P12 key file</b> is downloaded to your computer. We will use this file in our API connection.</li>
  <li>Click <b>Close</b>.</li>
  <li>Now you may use downloaded *.p12 key file as secret file and Service Account Email as Client ID (e.g. <b>some-service-account-name@your-project-id.iam.gserviceaccount.com</b> ).</li>
</ol>

<h3>Add Permission</h3>
Now last thing is give read/write permission to Service Account for Calendar you like to access using API. 
<ol>
  <li>Copy the email address of your service account we created in previous step (its usually like this some-service-account-name@your-project-id.iam.gserviceaccount.com).</li>
  <li>Login to https://calendar.google.com/calendar and make sure you see the calendar you like to access via API</li>
  <li>On the left, find the "My calendars" section. To expand it, click the Down arrow Down arrow.</li>
  <li>Hover over the calendar you want to share, and click 3 dots next to it. Click "Settings and sharing".</li>
  <li>Find "Share with specific people", Click Add people button and enter the service account email id we obtained in the previous section. </li>
  <li>Select correct permission you like to give for sharing. Click Send button to share. Thats it now we can read / write Calendar Events using Service account approach.</li>
  <li>For more information check this link https://support.google.com/calendar/answer/37082?hl=en</li>
</ol>

]]>
      </Notes>
    </Auth>

  
  </Auths>


  <Template> 
  </Template>

  <EndPoints>
    <!--=====================================
        ========= LIST CALENDARS ============
        =====================================-->  
    <EndPoint Name="list_calendars" 
              Label="List calendars" 
              Desc="Lists calendars"
	          Url="/users/me/calendarList" 
              Method="GET"
              Filter="$.items"
              CachedTtl="0"
              >
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="300" />
            <Column Name="summary" Label="Summary" DataType="DT_WSTR" Length="300" />
            <Column Name="description" Label="Description" DataType="DT_WSTR" Length="1500" />
            <Column Name="timeZone" Label="TimeZone" DataType="DT_WSTR" Length="300" />
        </OutputColumns>                  
    </EndPoint>

    <!--=====================================
        =========== LIST EVENTS =============
        =====================================-->  
    <EndPoint Name="list_events" 
              Label="List events" 
              Desc="Lists events"
	          Url="/calendars/[$CalendarId$]/events"
              Method="GET"
              Filter="$.items"
              >    
        <Params>
            <Param Name="CalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>
            <Param Name="NextUrlAttributeOrExpr"
                    Value="$.nextPageToken"
                    Type="Property"
            />
            <Param Name="NextUrlSuffix"
                    Value="pageToken=&lt;%nextlink%&gt;"
                    Type="Property"
            />                    
        </Params>      
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="300" />
            <Column Name="kind" Label="Kind" DataType="DT_WSTR" Length="300" />
            <Column Name="status" Label="Status" DataType="DT_WSTR" Length="300" />
            <Column Name="htmlLink" Label="HtmlLink" DataType="DT_WSTR" Length="1000" />
            <Column Name="created" Label="CreatedAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="updated" Label="UpdatedAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="summary" Label="Summary" DataType="DT_WSTR" Length="300" />
            <Column Name="description" Label="Description" DataType="DT_WSTR" Length="4000" />
            <Column Name="creator.email" Label="CreatorEmail" DataType="DT_WSTR" Length="300" />
            <Column Name="organizer.email" Label="OrganizerEmail" DataType="DT_WSTR" Length="300" />
            <Column Name="organizer.displayName" Label="OrganizerDisplayName" DataType="DT_WSTR" Length="300" />

            <Column Name="start.dateTime" Label="StartsAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="start.timeZone" Label="StartTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="end.dateTime" Label="EndsAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="end.timeZone" Label="EndTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="attendees" Label="Attendees" DataType="DT_NTEXT"/>
        </OutputColumns>                      
    </EndPoint>    

    <!--=====================================
        ============ GET EVENT ==============
        =====================================-->  
    <EndPoint Name="get_event" 
              Label="Get event" 
              Desc="Gets event"
	          Url="/calendars/[$CalendarId$]/events/[$EventId$]"
              Method="GET"
              >    
        <Params>
            <Param Name="CalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>
            <Param Name="EventId"
                   OptionsEndPoint="list_events"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   OptionEndPointParameters="CalendarId=[$CalendarId$];"
                   Required="True"/>                   
        </Params>      
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="300" />
            <Column Name="kind" Label="Kind" DataType="DT_WSTR" Length="300" />
            <Column Name="status" Label="Status" DataType="DT_WSTR" Length="300" />
            <Column Name="htmlLink" Label="HtmlLink" DataType="DT_WSTR" Length="1000" />
            <Column Name="created" Label="CreatedAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="updated" Label="UpdatedAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="summary" Label="Summary" DataType="DT_WSTR" Length="300" />
            <Column Name="description" Label="Description" DataType="DT_WSTR" Length="4000" />
            <Column Name="creator.email" Label="CreatorEmail" DataType="DT_WSTR" Length="300" />
            <Column Name="organizer.email" Label="OrganizerEmail" DataType="DT_WSTR" Length="300" />
            <Column Name="organizer.displayName" Label="OrganizerDisplayName" DataType="DT_WSTR" Length="300" />
            <Column Name="start.dateTime" Label="StartsAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="start.timeZone" Label="StartTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="end.dateTime" Label="EndsAt" DataType="DT_DBTIMESTAMP" />
            <Column Name="end.timeZone" Label="EndTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="attendees" Label="Attendees" DataType="DT_NTEXT"/>
        </OutputColumns>                                    
    </EndPoint>      

    <!--=====================================
        =========== CREATE EVENT ============
        =====================================-->  
    <EndPoint Name="create_event" 
              Label="Create event" 
              Desc="Creates event"
	          Url="/calendars/[$CalendarId$]/events"
              Method="POST"
              DotAsPath="True"
              ContentType="application/json"
              JsonRowFormat="Multicontent"
              >    
        <Params>
            <Param Name="CalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>
        </Params>      
        <Body><![CDATA[{$rows$}]]></Body>
        <InputColumns>
            <Column Name="start.date" Label="StartsOn" Desc="Use StartsOn OR StartsAt" Example="2021-12-24" DataType="DT_DBDATE" />
            <Column Name="start.dateTime" Label="StartsAt" Desc="Use StartsOn OR StartsAt" Example="2021-12-24T18:30:00" DataType="DT_DBTIMESTAMP" />
            <Column Name="start.timeZone" Label="StartsInTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="end.date" Label="EndsOn" DataType="DT_DBDATE" Example="2021-12-24"/>
            <Column Name="end.dateTime" Label="EndsAt" DataType="DT_DBTIMESTAMP" Example="2021-12-24T18:30:00" />
            <Column Name="end.timeZone" Label="EndsInTimeZone" DataType="DT_WSTR" Length="300" />
            <Column Name="attachments.fileUrl" Label="Kind" DataType="DT_WSTR" Length="300" />
            <Column Name="attendees" Label="Attendees" DataType="DT_NTEXT"/>
            <Column Name="description" Label="Description" DataType="DT_WSTR" Length="4000" />
            <Column Name="guestsCanInviteOthers" Label="GuestsCanInviteOthers" DateType="DT_BOOL" />
            <Column Name="guestsCanModify" Label="GuestsCanModify" DateType="DT_BOOL" />
            <Column Name="guestsCanSeeOtherGuests" Label="GuestsCanSeeOtherGuests" DateType="DT_BOOL" />
            <Column Name="location" Label="Location" DateType="DT_WSTR" Length="1024" />
            <Column Name="recurrence" Label="Recurrence" HelpLink="https://developers.google.com/calendar/api/v3/reference/events/insert" DataType="DT_WSTR" Length="1024"/>
            <Column Name="status" Label="Status" DataType="DT_WSTR" Length="50" Example="confirmed OR tentative OR cancelled"/>
            <Column Name="summary" Label="Summary" DataType="DT_WSTR" Length="300" />
            <Column Name="transparency" Label="Transparency" DataType="DT_WSTR" Length="300" Example="opaque OR transparent"/>
            <Column Name="visibility" Label="Visibility" DataType="DT_WSTR" Length="300" Example="default OR public OR private OR confidential"/>            
        </InputColumns>                                    
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="50" />
            <Column Name="status" Label="Status" DataType="DT_WSTR" Length="50" />
            <Column Name="created" Label="Created" DataType="DT_DBTIMESTAMP"/>
            <Column Name="updated" Label="Updated" DataType="DT_DBTIMESTAMP"/>
            <Column Name="htmlLink" Label="HtmlLink" DataType="DT_WSTR" Length="4000"/>
            <Column Name="iCalUID" DataType="DT_WSTR" Length="1024"/>
            <Column Name="eventType" DataType="DT_WSTR" Length="128"/>
        </OutputColumns>
    </EndPoint>    

    <!--=====================================
        =========== DELETE EVENT ============
        =====================================-->  
    <EndPoint Name="delete_event" 
              Label="Delete event" 
              Desc="Deletes event"
	          Url="/calendars/[$CalendarId$]/events/[$EventId$]"
              Method="DELETE"
              DotAsPath="True"
              ContentType="application/json"
              JsonRowFormat="Multicontent"
              >    
        <Params>
            <Param Name="CalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>
            <Param Name="EventId"
                   OptionsEndPoint="list_events"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>                   
        </Params>      
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="50" />
        </OutputColumns>
    </EndPoint>             

    <!--=====================================
        ============ MOVE EVENT =============
        =====================================-->  
    <EndPoint Name="move_event" 
              Label="Move event to another calendar" 
              Desc="Moves event from one calendar to another"
	            Url="/calendars/[$SourceCalendarId$]/events/[$EventId$]/move?destination=[$TargetCalendarId$]"
              Method="POST"
              DotAsPath="True"
              ContentType="application/json"
              JsonRowFormat="Multicontent"
              >    
        <Params>
            <Param Name="SourceCalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>
            <Param Name="TargetCalendarId"
                   OptionsEndPoint="list_calendars"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>                   
            <Param Name="EventId"
                   OptionsEndPoint="list_events"
                   OptionsEndPointValueColumn="Id"
                   OptionsEndPointLabelColumn="Summary"
                   Required="True"/>                   
        </Params>      
        <OutputColumns>
            <Column Name="id" Label="Id" DataType="DT_WSTR" Length="50" />
        </OutputColumns>
    </EndPoint>     
  </EndPoints>



  <!--=====================================
      ============= TABLES ================
      =====================================--> 

  <Tables> 
      <Table Name="Events" 
             Desc="Insert, update, delete and list datasets"
             SelectEndPoint="list_events"
             InsertEndPoint="create_event"
             DeleteEndPoint="delete_event" 
      />
      <Table Name="Calendars"
             SelectEndPoint="list_calendars"
      />
  </Tables>    


  <!--=====================================
      ============ EXAMPLES ===============
      =====================================-->
  <Examples>
    <!-- LIST CALENDARS -->
    <Example Group="ODBC" Label="List calendars" Desc="Lists calendars">
        <Code>
            <![CDATA[SELECT * FROM Calendars]]>
        </Code>
    </Example> 

    <!-- LIST EVENTS -->
    <Example Group="ODBC" Label="List events" Desc="Lists events">
        <Code>
            <![CDATA[SELECT * FROM Events
  WITH (CalendarId='MyCalendarId')]]>
        </Code>
    </Example> 

    <!-- GET EVENT -->
    <Example Group="ODBC" Label="Get event" Desc="Gets event">
        <Code>
            <![CDATA[SELECT * FROM get_event
  WITH (CalendarId='MyCalendarId'
       ,EventId='MyEventId')]]>
        </Code>
    </Example> 

    <!-- CREATE EVENT -->
    <Example Group="ODBC" Label="Create event" Desc="Creates event">
        <Code>
            <![CDATA[INSERT INTO Events(StartsAt, StartsInTimeZone, EndsAt, EndsInTimeZone, Summary,
  Attendees, Description, Location, Status, Transparency, Visibility)
  VALUES ('2021-11-26T16:30:50', 'Europe/Vilnius', '2021-11-27T16:30:50','Europe/Vilnius', 'This is an event',
          null, 'My Description', 'Vilnius', 'confirmed', 'opaque', 'default')
  WITH (CalendarId='YourCalendarId')
        ]]>
        </Code>
    </Example> 

    <!-- DELETE EVENT -->
    <Example Group="ODBC" Label="Get event" Desc="Gets event">
        <Code>
            <![CDATA[DELETE FROM Events
    WITH (CalendarId='MyCalendarId',
    EventId='MyEventId')]]>
        </Code>
    </Example> 

    <!-- MOVE EVENT -->
    <Example Group="ODBC" Label="Move event to a different calendar" Desc="Moves event to a different calendar">
        <Code>
            <![CDATA[UPDATE move_event
  WITH (SourceCalendarId='MySourceCalendarId',
  TargetCalendarId='MyTargetCalendarId',
  EventId='MyEventId'
  )]]>
        </Code>
    </Example>
  </Examples>
</ApiConfig>