Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class 'ItemResponseShapeType' not found #600

Open
victorpictor76 opened this issue Jul 1, 2021 · 1 comment
Open

Class 'ItemResponseShapeType' not found #600

victorpictor76 opened this issue Jul 1, 2021 · 1 comment

Comments

@victorpictor76
Copy link

Version (e.g. 1.0, dev-master): 1.0.0
PHP version: 5.4.16
Microsoft Exchange version: 2019

Description of problem:

Hi there! I'm new to this project, I'd like to read a mailbox's calendar, and process the data. I've only tried an example so far,
but could not get it to work.

Example request:

// Formatted example request.

require_once '/etc/vendor/autoload.php';

use \jamesiarmes\PhpEws\Client;
use \jamesiarmes\PhpEws\Request\FindItemType;

use \jamesiarmes\PhpEws\ArrayType\NonEmptyArrayOfBaseFolderIdsType;

use \jamesiarmes\PhpEws\Enumeration\DistinguishedFolderIdNameType;
use \jamesiarmes\PhpEws\Enumeration\ResponseClassType;

use \jamesiarmes\PhpEws\Type\ContactsViewType;
use \jamesiarmes\PhpEws\Type\DistinguishedFolderIdType;

$start_date = new Datetime('today -1 months');
$end_date = new Datetime('today +1 months');

$timezone = 'W. Europe Standard Time';

$host = 'webmail.site.eu';
$username = 'user';
$password = 'password';
$version = Client::VERSION_2016;

$client = new Client($host, $username, $password, $version);

$client->setTimezone($timezone);

$request = new FindItemType();
$request->ParentFolderIds = new NonEmptyArrayOfBaseFolderIdsType();

$request->ItemShape = new ItemResponseShapeType();
$request->ItemShape->BaseShape = DefaultShapeNamesType::ALL_PROPERTIES;
$folder_id = new DistinguishedFolderIdType();
$folder_id->Id = DistinguishedFolderIdNameType::CALENDAR;
$request->ParentFolderIds->DistinguishedFolderId[] = $folder_id;
$request->Traversal = ItemQueryTraversalType::SHALLOW;
$request->CalendarView = new CalendarViewType();
$request->CalendarView->StartDate = $start_date->format('c');
$request->CalendarView->EndDate = $end_date->format('c');
$request->ConnectionTimeout = 60;

$response = $client->FindItem($request);

$response_messages = $response->ResponseMessages->FindItemResponseMessage;
foreach ($response_messages as $response_message) {
  $items = $response_message->RootFolder->Items->CalendarItem;
..
    foreach ($items as $event){
        $id = $event->ItemId->Id;
        $subject = $event->Subject;
         }
}


Example response:

PHP Fatal error:  Class 'ItemResponseShapeType' not found in /etc/vendor/php-ews/php-ews/src/feff.php on line 34

// Formatted example response.

Additional details:

@jameswillhoite
Copy link

This is old, but you do not have a "use" statement for ItemResponseShapeType. Or you have to fully qualify the Namespace for that object.

$request->ItemShape = new jamesiarmes\PhpEws\Type\ItemResponseShapeType();
$request->ItemShape->BaseShape = DefaultShapeNamesType::ALL_PROPERTIES;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants