Google Calendar list events method not returning any events
<p>The <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list" rel="nofollow">Events: list</a> is not returning all the events.</p>

<p>I see a lot of events on the calendar, but when I call <a href="https://developers.google.com/google-apps/calendar/v3/reference/events/list" rel="nofollow">Events: list</a>, I get only some of them.</p>

<p>It's not a matter of maxResults being too low. I have it set to return 2500, the max. I get 1251 or so, I deleted about 24 via the API, and now it returns 1227.  However there are a bunch on the calendar that aren't coming back.</p>

<p>It's not a matter of the page token either. I'm looping to see if somehow the rest are on the next pageToken list, but when I call getNextPageToken after the first page, it's null.</p>

<p>The optional parameters I'm using is:</p>

<pre><code>    $optParams = array(
        'maxResults' =&gt; 2500,
        'singleEvents' =&gt; TRUE,
        'pageToken' =&gt; $pageToken,
    );
</code></pre>

<p>If I set singleEvents to be false, or remove it, Google responds with an error.</p>

<blockquote>
  <p><strong>singleEvents</strong>  boolean Whether to expand recurring events into instances
  and only return single one-off events and instances of recurring
  events, but not the underlying recurring events themselves. Optional.
  The default is False.</p>
</blockquote>

<p>This seemed to start happening about when Google changed the GMail name to <a href="https://gsuite.google.com/together/" rel="nofollow">G suites</a>.</p>

<p>My code is below: (when I var_dump $calendarList, I get only 1 calendar.  I used similar code to add the calendar events in the first place.)</p>

<pre><code>$calendarList  = $service-&gt;calendarList-&gt;listCalendarList();
$calendarListEntry = $service-&gt;calendarList-&gt;get('primary');

$continue = 1;
echo "reading the calendar for duplicate appointments&lt;br&gt;";
while ($continue == 1) {
    $optParams = array(
        'maxResults' =&gt; 2500,
        'singleEvents' =&gt; TRUE,
        'pageToken' =&gt; $pageToken,
    );

    $events = $service-&gt;events-&gt;listEvents($calendarListEntry-&gt;id, $optParams);
    foreach ($events-&gt;getItems() as $event) {
        //process events
    }
    $pageToken = $events-&gt;getNextPageToken();
    if ($pageToken == null) { continue = 0; }
}
</code></pre>

<p>Edit:  weirdly, when I lowered the maxResults to 250, I got a few that hadn't shown up in the result originally.  But I'm still not getting all of them.</p>

<p>Edit2: forgot to include the call to read the next page token.</p>

<p>Edit 3: Weirdly, although I'm passing in 'singleEvents' => TRUE, I'm also getting events that are marked to repeat.</p>