当我使用PHP-EWS创建日历项目(约会)作为交换时,我试图触发一个事件。目前,我可以在发送电子邮件时触发事件:
$subscribe_request = new \EWSType_SubscribeType();
$pushSubscription = new \EWSType_PushSubscriptionRequestType();
$pushSubscription->StatusFrequency = 1;
$pushSubscription->URL = 'http://someserver/log.php';
$folderIDs = new \EWSType_NonEmptyArrayOfBaseFolderIdsType();
$eventTypes = new \EWSType_NonEmptyArrayOfNotificationEventTypesType();
$folderIDs->DistinguishedFolderId = new \EWSType_DistinguishedFolderIdType();
$folderIDs->DistinguishedFolderId->Id = \EWSType_DistinguishedFolderIdNameType::INBOX;
$eventTypes->EventType = "NewMailEvent";
$pushSubscription->FolderIds = $folderIDs;
$pushSubscription->EventTypes = $eventTypes;
$subscribe_request->PushSubscriptionRequest = $pushSubscription;
return $this->ews->Subscribe($subscribe_request);
日志文件
class ewsService {
public function SendNotification($arg) {
file_put_contents("C:\\exchangelogs\\log_".time().".txt", print_r($arg,1));
$result = new EWSType_SendNotificationResultType();
$result->SubscriptionStatus = 'OK';
//$result->SubscriptionStatus = 'Unsubscribe';
return $result;
}
}
$opts = array();
$server = new SoapServer(
'NotificationService.wsdl',
array('uri' => 'http://someserver/log.php'));
$server->setObject($service = new ewsService());
$server->handle();
每分钟都会发送一条“保持活动消息”并SendNotification
调用该函数。发送邮件时(使用 Outlook 或其他)也会发生同样的事情。
这一切都很好。
但是,现在我想在创建日历项目(例如约会)时执行相同的操作。我尝试更改DistinguishedFolderIdNameType
toCALENDAR
和EventType
to CreatedEvent
,但是在创建约会时我没有收到任何消息。
任何帮助是极大的赞赏。