EWS ruby​​观点批量订阅推送通知

Ric*_*een 5 ruby ruby-on-rails exchangewebservices microsoft-exchange viewpoint

我正在使用perspective gem来订阅microsoft exchange通知服务.到目前为止,我设法通过使用订阅方法订阅单个文件夹:https://github.com/WinRb/Viewpoint/blob/bcda30abdab99f52270f2c24a1c78364c986d967/lib/ews/soap/exchange_notification.rb

我尝试使用属于同一服务器上不同帐户的不同文件夹ID传递多个哈希值.

client.ews.subscribe(
[{ :push_subscription_request => {
  :folder_ids =>  [{id: calendar[:id], change_key: calendar[:change_key]}],
  :subscribe_to_all_folders => true,
  :event_types=>  %w{CopiedEvent CreatedEvent DeletedEvent MovedEvent},
  :status_frequency => 1,
  :uRL => 'https://51.ngrok.io/ews_watch',
}, 
{same again with different calendar ids}]
)
Run Code Online (Sandbox Code Playgroud)

我收到了来自ews的回复,但仅限于一个日历文件夹.

有谁知道如何批量订阅同一服务器上的多个邮箱,以便我从ews服务器收到批量推送通知,而不是为每个订阅获得一个?

谢谢

Cot*_*Joe 1

我会迭代它。取决于 ID 的存储位置:

@client.ews.subscribe.each do |ces| 
ces([{ :push_subscription_request => {
  :folder_ids =>  [{id: calendar[:id], change_key: calendar[:change_key]}],
  :subscribe_to_all_folders => true,
  :event_types=>  %w{CopiedEvent CreatedEvent DeletedEvent MovedEvent},
  :status_frequency => 1,
  :uRL => 'https://51.ngrok.io/ews_watch',
}])
end
Run Code Online (Sandbox Code Playgroud)

未经测试,但这应该可以解决问题。只需迭代 ID 即可。