0

I am trying to load some classes with the USE tag into my PagesController.

I have this currently:

use ExchangeWebServices;

use EWSType_FindItemType;

use EWSType_ItemQueryTraversalType;
use EWSType_ItemResponseShapeType;
use EWSType_DefaultShapeNamesType;
use EWSType_CalendarViewType;
use EWSType_NonEmptyArrayOfBaseFolderIdsType;
use EWSType_DistinguishedFolderIdType;
use EWSType_DistinguishedFolderIdNameType;

And then the class code:

public function getAgendaItems()
{

    $ews = new ExchangeWebServices(".com", "e.com", "");
    $request = new EWSType_FindItemType();
    // Use this to search only the items in the parent directory in question or use ::SOFT_DELETED
    // to identify "soft deleted" items, i.e. not visible and not in the trash can.
    $request->Traversal = EWSType_ItemQueryTraversalType::SHALLOW;
    // This identifies the set of properties to return in an item or folder response
    $request->ItemShape = new EWSType_ItemResponseShapeType();
    $request->ItemShape->BaseShape = EWSType_DefaultShapeNamesType::DEFAULT_PROPERTIES;
    // Define the timeframe to load calendar items
    $request->CalendarView = new EWSType_CalendarViewType();
    $request->CalendarView->StartDate = date("c"); // an ISO8601 date e.g. 2012-06-12T15:18:34+03:00
    $request->CalendarView->EndDate = date("c", mktime(0, 0, 0, date("m"), date("d"), date("Y") + 1)); // an ISO8601 date later than the above
    $request->CalendarView->MaxEntriesReturned = 14;
    // Only look in the "calendars folder"
    $request->ParentFolderIds = new EWSType_NonEmptyArrayOfBaseFolderIdsType();
    $request->ParentFolderIds->DistinguishedFolderId = new EWSType_DistinguishedFolderIdType();
    $request->ParentFolderIds->DistinguishedFolderId->Id = EWSType_DistinguishedFolderIdNameType::CALENDAR;
    // Send request
    $response = $ews->FindItem($request);
    // Loop through each item if event(s) were found in the timeframe specified
    if ($response->ResponseMessages->FindItemResponseMessage->RootFolder->TotalItemsInView > 0) {
        $events = $response->ResponseMessages->FindItemResponseMessage->RootFolder->Items->CalendarItem;
        /*foreach ($events as $event){
            $id = $event->ItemId->Id;
            $change_key = $event->ItemId->ChangeKey;
            $start = $event->Start;
            $end = $event->End;
            $subject = $event->Subject;
            $location = $event->Location;
   //                var_dump($event);
        }*/
        return $events;
    } else {
        return array();
        // No items returned
    }
}

The classes are in src\library\Exchange.

All of the classes are loaded in there but not accessible through this method of mine.

Now my question is: how do I include those classes in my file?

Like the normal include_once thing in php.

It shows this error:

Class 'ExchangeWebServices' not found.

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58

0 Answers0