question

RenBurowSrensen-3897 avatar image
0 Votes"
RenBurowSrensen-3897 asked RenBurowSrensen-3897 commented

PHP SDK - Timeout while getting calendar events

When sending a request for events for the next 1825 days (max allowed) I get a timeout for 2 authorizations (out of maybe 80 in total). The timeout I get is from Guzzle/cURL

The code i use is the following:

$calendar_id is a valid UUID for a calendar.
$from and $to are DateTime objects.

$events = [];

$query = [
'startDateTime' => $from->format('c'),
'endDateTime' => $to->format('c'),
];

$response = $this->graph->createCollectionRequest('GET', '/me/calendars/'.$calendar_id.'/calendarView?'.http_build_query($query))
->setReturnType(Model\Event::class)
->addHeaders(['Prefer' => 'outlook.timezone="Europe/Copenhagen"'])
->setTimeout(20)
->setPageSize(20);

while(!$response->isEnd()){
$events = array_merge($events, $response->getPage());
}

return $events;

microsoft-graph-calendar
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered RenBurowSrensen-3897 commented

When you deal with good number of data in response (as i see that you're trying with max value), i would suggest you to use Microsoft Graph pagination to start with.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you for your answer!

As i understand the code behind the createCollectionRequest it's actually using the pagination functionality (the getPage() method)

Also, I have other authorizations which are delivered correctly. This is a puzzle :)

0 Votes 0 ·