EWS ruby ​​viewpoint push notification batch subscription

I use a gem point of view to sign up for the Microsoft Exchange Notification Service. So far, I have managed to subscribe to one folder using the subscribe method: https://github.com/WinRb/Viewpoint/blob/bcda30abdab99f52270f2c24a1c78364c986d967/lib/ews/soap/exchange_notification.rb

I tried to transfer several hashes with different folder identifiers belonging 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 answers from ews, but only for one calendar folder.

Does anyone know how to batch subscribe to multiple mailboxes on the same server so that I receive a batch push notification from the ews server instead of receiving one for each subscription?

thanks

+5
source share
1 answer

I would try this. Depending on where the identifier is 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 tested, but this should do the trick. Just iterate over identifiers.

+1
source

Source: https://habr.com/ru/post/1263340/


All Articles