lib/ews/types/generic_folder.rb
def subscribe(evtypes = [:all], watermark = nil, timeout = 240)
      # Refresh the subscription if already subscribed
      unsubscribe if subscribed?

      event_types = normalize_event_names(evtypes)
      folder = {id: self.id, change_key: self.change_key}
      resp = ews.pull_subscribe_folder(folder, event_types, timeout, watermark)
      rmsg = resp.response_messages.first
      if rmsg.success?
        @subscription_id = rmsg.subscription_id
        @watermark = rmsg.watermark
        true
      else
        raise EwsSubscriptionError, "Could not subscribe: #{rmsg.code}: #{rmsg.message_text}"
      end
    end
def subscribe(evtypes = [:all], watermark = nil, timeout = 240)
      # Refresh the subscription if already subscribed
      unsubscribe if subscribed?

      event_types = normalize_event_names(evtypes)
      folder = {id: self.id, change_key: self.change_key}
      resp = ews.pull_subscribe_folder(folder, event_types, timeout, watermark)
      rmsg = resp.response_messages.first
      if rmsg.success?
        @subscription_id = rmsg.subscription_id
        @watermark = rmsg.watermark
        true
      else
        raise EwsSubscriptionError, "Could not subscribe: #{rmsg.code}: #{rmsg.message_text}"
      end
    end
def subscribe ( evtypes = [ :all ] , watermark = nil , timeout = 240 ) # Refresh the subscription if already subscribed unsubscribe if subscribed? event_types = normalize_event_names ( evtypes ) folder = { id : self . id , change_key : self . change_key } resp = ews . pull_subscribe_folder ( folder , event_types , timeout , watermark ) rmsg = resp . response_messages . first if rmsg . success? @subscription_id = rmsg . subscription_id @watermark = rmsg . watermark true else raise EwsSubscriptionError , "Could not subscribe: #{rmsg.code}: #{rmsg.message_text}" end end
Subscribe this folder to events.  This method initiates an Exchange pull
 type subscription.

 @param event_types [Array] Which event types to subscribe to. By default
   we subscribe to all Exchange event types: :all, :copied, :created,
   :deleted, :modified, :moved, :new_mail, :free_busy_changed
 @param watermark [String] pass a watermark if you wish to start the
   subscription at a specific point.
 @param timeout [Fixnum] the time in minutes that the subscription can
   remain idle between calls to #get_events. default: 240 minutes
 @return [Boolean] Did the subscription happen successfully?
Subscribe this folder to events . This method initiates an Exchange pull type subscription .