jamesiarmes / php-ews

PHP Exchange Web Services
http://jamesarmes.com/php-ews/
MIT License
567 stars 304 forks source link

How to access another mailbox calendar events ? #470

Open fabur1964 opened 6 years ago

fabur1964 commented 6 years ago

Version :1.0, dev-master PHP version:7.0 Microsoft Exchange version: 2013

Description of problem: Hi, In script below (based on examples\event\create.php) i try to access to another mailbox calendar but the event is only write in my personal calendar and not in 'utilisateur''s calendar.

Example request:

...
$request->Items->CalendarItem[] = $event;
$request->ParentFolderIds = new NonEmptyArrayOfBaseFolderIdsType();
                $request->ParentFolderIds->DistinguishedFolderId = new DistinguishedFolderIdType();
                $request->ParentFolderIds->DistinguishedFolderId->Id = DistinguishedFolderIdNameType::CALENDAR;
                $mailBox = new EmailAddressType();
                $mailBox->EmailAddress = "utilisateur@serveur.fr";
                $request->ParentFolderIds->DistinguishedFolderId->Mailbox = $mailBox;
                $request->Traversal = ItemQueryTraversalType::SHALLOW;
$response = $client->CreateItem($request);
..
fabur1964 commented 6 years ago

In progress ;-) With the code below then response is Event failed to create with "ErrorFolderNotFound: The specified folder could not be found in the store." when i try to write in "utilisateur"'s calendar. Is it because i've no right on his calendar ?

$mailBox = new EmailAddressType();
$user_calendar = "utilisateur";
$domaine = "serveur.fr";
$mailBox->EmailAddress = "$user_calendar@$domaine";

$request->SavedItemFolderId = new TargetFolderIdType();
$request->SavedItemFolderId->DistinguishedFolderId = new DistinguishedFolderIdType();
$request->SavedItemFolderId->DistinguishedFolderId->Id=DistinguishedFolderIdNameType::CALENDAR;
$request->SavedItemFolderId->DistinguishedFolderId->Mailbox = $mailBox;

$response = $client->CreateItem($request);
fabur1964 commented 6 years ago

oups