是否可以订阅 Exchange 房间资源日历的推送通知

Is it possible to subscribe push notifications for Exchange room resource calendar

我们有一个现有的实现,它通过 EWS Managed API 订阅 Office 365 Exchange Online 中用户日历的推送通知。

PushSubscription pushSubscription = exchangeService.SubscribeToPushNotifications(
    new FolderId[] { WellKnownFolderName.Calendar },
    new Uri(callbackEndpoint), statusFrequency, null,
    EventType.Created, EventType.Deleted, EventType.Modified,
    EventType.Moved, EventType.Copied, EventType.FreeBusyChanged);

除了,其他都还好;日历上安排的约会会向我们的网络服务发送通知。

现在我们想知道是否可以从房间资源邮箱的角度订阅,而不是从用户邮箱的角度监视事件。

// Set room mailbox address.
exchangeService.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, roomAddress);

PushSubscription pushSubscription = exchangeService.SubscribeToPushNotifications(
    new FolderId[] { WellKnownFolderName.Calendar },
    new Uri(callbackEndpoint), statusFrequency, null,
    EventType.Created, EventType.Deleted, EventType.Modified,
    EventType.Moved, EventType.Copied, EventType.FreeBusyChanged);

可惜事情并没有这么简单,

The request failed. The remote server returned an error: (457) https://autodiscover-s.outlook.com/owa/domain.onmicrosoft.com.

我找不到任何深入的 material 解释错误 457 的真正含义,以及如何解决这个问题。

此外,我还没有发现任何其他人试图订阅资源邮箱。是因为它完全不可能,还是根本没有人发现有必要这样做?

更新

尝试使用 EWSEditor tool 来查看可以嗅出哪些额外的细节;似乎冒充房间邮箱需要某种特殊许可。

Exception details: Message: The account does not have permission to impersonate the requested user. Type: Microsoft.Exchange.WebServices.Data.ServiceResponseException Source: Microsoft.Exchange.WebServices ErrorCode: ErrorImpersonateUserDenied ErrorMessage: The account does not have permission to impersonate the requested user. Stack Trace: at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest 1.Execute() at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalConvertIds(IEnumerable 1 ids, IdFormat destinationFormat, ServiceErrorHandling errorHandling)
at Microsoft.Exchange.WebServices.Data.ExchangeService.ConvertIds(IEnumerable 1 ids, IdFormat destinationFormat) at EWSEditor.Common.Extensions.ExchangeServiceExtensions.TestExchangeService(ExchangeService service)

我尝试在 Office 365 管理界面中为邮箱委派分配完全访问权限,但这似乎没有任何帮助。

看起来实现这一目标的关键是为指定的服务帐户启用模拟。

http://blogs.msdn.com/b/pareshj/archive/2011/11/29/exchange-web-services-fail-using-impersonation-to-access-mailboxes.aspx

http://msdn.microsoft.com/en-us/library/bb204095.aspx

一旦为组织帐户和指定的用户帐户完成此操作,就可以使用模拟的房间邮箱与 EWS 进行交互并进行订阅。