I'm using viewpoint gem to subscribe to microsoft exchange notification service. So far I managed to subscribe to a single folder by using subscribe method in this: https://github.com/WinRb/Viewpoint/blob/bcda30abdab99f52270f2c24a1c78364c986d967/lib/ews/soap/exchange_notification.rb
I tried passing multiple hashes with different folder ids that belong to different accounts on the same server.
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}]
)
I get the responses from ews, but only for a single calendar folder.
Does anyone know how to batch subscribe to multiple mailboxes on the same server so that I would receive a batch push notification from ews server instead of getting one for each subscription ?
Thank you
I would iterate through it. Depending on where the ID's are stored:
@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
Not testeted, but this should do the trick. Just iterate over the ID's.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With