Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to Exchange online API from PHP

I have a task at hand which requires me to connect Exchange Online account and list all the calendar entries in PHP.

I have read through many Microsoft help doc but it all refers to c# code. Can someone please guide me through steps to achieve this using PHP.

like image 334
VMN Avatar asked Feb 18 '13 13:02

VMN


1 Answers

Try this:

$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;

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

like image 130
fnkr Avatar answered Nov 15 '22 05:11

fnkr