jamesiarmes / php-ews

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

Empty itemId on push subscriptions #526

Open DianaPinheiro opened 5 years ago

DianaPinheiro commented 5 years ago

I am currently subscribing to push notifications for calendar events and logging notifications. To subscribe, I use the following code:

$eventTypes = new NonEmptyArrayOfNotificationEventTypesType();
$eventTypes->EventType[] = NotificationEventTypeType::CREATED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::MODIFIED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::DELETED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::COPIED_EVENT;
$eventTypes->EventType[] = NotificationEventTypeType::MOVED_EVENT;

$folderIDs = new NonEmptyArrayOfBaseFolderIdsType();
$folderIDs->DistinguishedFolderId = new DistinguishedFolderIdType();
$folderIDs->DistinguishedFolderId->Id = DistinguishedFolderIdNameType::CALENDAR;

$pushSubscription = new PushSubscriptionRequestType();
$pushSubscription->FolderIds = $folderIDs;
$pushSubscription->EventTypes = $eventTypes;
$pushSubscription->StatusFrequency = $this->statusFrequency;
$pushSubscription->URL = $this->subscriptionUrl;

$subscribe_request = new SubscribeType();
$subscribe_request->PushSubscriptionRequest = $pushSubscription;

As you can notice below, when I mark a meeting (for example) I get the notification as it would be supposed but the ItemId or ParentFolderId comes empty! What am I doing wrong? How can I receive these fields when I create a meeting in the calendar?

{
      "SubscriptionId": "xxxxxxxx",
      "PreviousWatermark": "xxxxxxxx",
      "MoreEvents": "false",
      "CreatedEvent": {
        "Watermark": "xxxxx",
        "TimeStamp": "2018-08-13T13:18:12Z",
        "ItemId": "",
        "ParentFolderId": ""
      },
      "ModifiedEvent": [
        {
          "Watermark": "xxxxxxx",
          "TimeStamp": "2018-08-13T13:18:13Z",
          "ItemId": "",
          "ParentFolderId": ""
        },
        {
          "Watermark": "xxxxxxx",
          "TimeStamp": "2018-08-13T13:18:13Z",
          "FolderId": "",
          "ParentFolderId": ""
        }
      ]
}