我正在开发一个Web平台,并且正在与AD和Exchange Web Services建立连接。
对于Exchange,我将PHP-EWS jamesiarmes / php-ews库与Symfony 4.1结合使用。
我当前正在订阅日历事件的推送通知和日志记录通知。
要订阅,我使用以下代码:
$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;
下面您会注意到,例如,当我标记会议时,我会按预期收到通知,但ItemId或ParentFolderId为空!我究竟做错了什么?在日历中创建会议时如何接收这些字段?
{
"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": ""
}
]
}