From 69cbf57bfa19200945a30014895e78bd218b5909 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Mon, 8 Jul 2024 22:44:17 +0200 Subject: [PATCH] Add a method to find items using a calendar view (#276) The calendar view will not only list the single calendar items between the start and end date but also occurences of recurring calendar items. See also: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/calendarview This method was original already present in Viewpoint < 1.0. --- lib/ews/types/calendar_folder.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/ews/types/calendar_folder.rb b/lib/ews/types/calendar_folder.rb index a1592c30..0bf11ce1 100644 --- a/lib/ews/types/calendar_folder.rb +++ b/lib/ews/types/calendar_folder.rb @@ -28,6 +28,19 @@ def items_between(start_date, end_date, opts={}) end end + # Fetch items between a given time period using a calendar view. + # The calendar view will include occurences of recurring calendar items + # next to the regular single calendar items. + # @param [DateTime] start_date the time to start fetching Items from + # @param [DateTime] end_date the time to stop fetching Items from + # @param opts [Hash] + # @option opts :max_entries_returned [Integer] the maximum number of entries to return + def items_between_calendar_view(start_date, end_date, opts={}) + view_opts = {:start_date => start_date, :end_date => end_date} + view_opts[:max_entries_returned] = opts.delete(:max_entries_returned) if opts[:max_entries_returned] + items(opts.merge(:calendar_view => view_opts)) + end + # Creates a new appointment # @param attributes [Hash] Parameters of the calendar item. Some example attributes are listed below. # @option attributes :subject [String]