exchangewebservices - 如何使用托管 API 取消订阅 EWS 推送通知

标签 exchangewebservices ews-managed-api

我正在使用 EWS 托管 API 进行推送订阅。工作正常

现在我想退订

托管 API 文档 http://msdn.microsoft.com/en-us/library/office/dn458791(v=exchg.150).aspx说使用 service.EndSubscribeToPushNotifications .这显然是错误的——这个函数是一对 BeginSubscribeTo ...异步操作(反射器确认了这一点)

我在 ExchangeService 上看不到明显的方法.

一般 EWS 文档 http://msdn.microsoft.com/en-us/library/office/aa564263(v=exchg.150).aspx说发送这个 XML,但它只用于拉操作

那我该怎么办?

最佳答案

似乎没有办法取消订阅推送通知。唯一的选择是让它超时。

From http://blogs.msdn.com/b/emeamsgdev/archive/2012/12/20/ews-push-notification-sample.aspx

The Unsubscribe button doesn't actually do anything currently, as Unsubscribe has not been implemented in the managed API. I will implement an Unsubscribe at some point, though it is not overly important as once the listener is closed, the subscription will timeout after a while when Exchange does not receive a response (or cannot connect) to the listener end-point.


顺便说一句,MSDN 文档建议使用 Streaming 而不是推送通知:

From: Notification subscriptions, mailbox events, and EWS in Exchange

If you are using push notifications with Exchange 2010, consider upgrading your application to use streaming notifications, so that you don’t need a separate application to receive the events.


更新

Another source: Transitioning to Exchange Web Services Notifications

We are also often asked how push notifications timeouts work. Suppose your client subscribed to push notifications, and then unexpectedly goes offline. The server will not be able to push out the next set of events as notifications to the client (or, more importantly, the server will not get a response to its notifications message). Rather than give up right away, the server will retry to push them out up to three times. After the first failure, the server will wait the timeout amount of time (that’s the timeout that you set in the subscription request) and try again. If that attempt fails, the server will wait twice the timeout time and try again. If that fails, the server will wait three times the timeout time and try again. Finally, if the third retry attempt fails, the server will give up and delete the subscription.


更新 2
在托管 API 之外,您似乎可以通过在 SubscriptionStatus 元素中返回 Unsubscribe 而不是 OK 来终止订阅。

In summary, there are really two ways to end a subscription on a CAS:

  1. You can send “Unsubscribe” in the response message (as a response to a notifications message from the CAS).
  2. You can become unresponsive to notifications messages.

We recommend the first method (sending an unsubscribe message) rather than the second method, which causes the Client Access server to perform unnecessary work.


MSDN:SubscriptionStatus
代码示例(带有 SubscriptionStatus.OK,所以你必须将其设置为 Unsubscribe 才能获得预期的效果):Exchange Web Services .NET > Tutorial > Push event notification

关于exchangewebservices - 如何使用托管 API 取消订阅 EWS 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21636201/

相关文章:

exchangewebservices - EWS - 将查询字符串与搜索过滤器对象相结合

c# - 如何更新 Exchange Web Api 中的联系人项目

c# - Exchange Web 服务 : Batching with FindItemsResult<Item>

c# - 从收件箱下载附件时如何减少 EWS 调用?

calendar - 为什么 EWS 托管 API SyncFolderItems 不返回定期约会

exchange-server - 将 EWS 对话*与 Outlook 插件对话*匹配

outlook - Exchange Web 服务 - 确认 session 请求响应

c# - 使用 Exchange Web 服务创建具有默认签名的新邮件

c# - EWS 托管 API : Can I load properties for multiple items with one EWS call, 仅给出项目 ID?

c# - 如何为通过 Exchange Server 发送的邮件设置 MHT-body?