How to connect to Exchange online interface with PHP

I have a task that requires me to connect an Exchange Online account and list all calendar entries in PHP.

I read a lot of Microsoft docs, but it all relates to C # code. Can someone please guide me through the steps to achieve this using PHP.

+5
source share
1 answer

Try the following:

$ews = new ExchangeWebServices($host, $username, $password);

$request = new EWSType_FindItemType();
$request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;

$request->ItemShape = new EWSType_ItemResponseShapeType();
$request->ItemShape->BaseShape =
        EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;

$request->CalendarView = new EWSType_CalendarViewType();
$request->CalendarView->StartDate = date('c', strtotime('01/01/2011 -00'));
$request->CalendarView->EndDate = date('c', strtotime('01/31/2011 -00'));

$request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
$request->ParentFolderIds->DistinguishedFolderId =
        new EWSType_DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id =
        EWSType_DistinguishedFolderIdNameType::CALENDAR;

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

+14
source

All Articles