Search code examples
phpexchangewebservicesphp-ews

php-ews: Access shared calendars?


Using php-ews: https://github.com/jamesiarmes/php-ews

I'm able to list events from my own calendar according to this example: https://github.com/jamesiarmes/php-ews/wiki/Calendar:-Get-List-(Retrieving-Id-and-ChangeKey) But after searching for a solution for a few hours I still haven't been able to find a way to access shared calendars.

This question is similar, but has no answer: EWS: Access shared calendars

From looking at that and various other search results (I've googled many variants of "ews shared calendar") I have to find the location of the shared calendar, get the id and then use that. But I haven't been able to do that. Can anyone help?


Solution

  • In the code block under Only look in the "calendars folder" add this in order to retrieve events from [email protected]'s calendar:

    $request->ParentFolderIds->DistinguishedFolderId->Mailbox = new StdClass;
    $request->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = '[email protected]';