From fb8edab3f8a3ad8c7f6666b4286dd468e3e3be00 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Mon, 8 Jul 2024 22:43:59 +0200 Subject: [PATCH] Add method for deleting calendar items with meeting cancellation (#277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The deletion of calendar items requires that is defined who to send meeting cancellations to. This adds a method on CalenderItem that allows the cancellation type to be set or falls back to a default. See also: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/deleteitem It is similar to a method that was present in Viewpoint ≤ 0.1.27. --- lib/ews/types/calendar_item.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ews/types/calendar_item.rb b/lib/ews/types/calendar_item.rb index 41bd765e..be81144a 100644 --- a/lib/ews/types/calendar_item.rb +++ b/lib/ews/types/calendar_item.rb @@ -40,6 +40,18 @@ class CalendarItem } CALENDAR_ITEM_KEY_ALIAS = {} + # Delete this calendar item + # @param deltype [Symbol] The delete type; must be :hard, :soft, or :recycle. + # By default EWS will do a hard delete of this calendar item. See the= + # MSDN docs for more info: http://msdn.microsoft.com/en-us/library/aa562961.aspx + # @param cancel_type [String] 'SendToNone'/'SendOnlyToAll'/'SendToAllAndSaveCopy' + # Default is 'SendOnlyToAll' + # @return [Boolean] Whether or not the calendar item was deleted + def delete!(deltype = :hard, cancel_type = 'SendOnlyToAll', opts = {}) + opts = opts.merge(:send_meeting_cancellations => cancel_type) + super(deltype, opts) + end + # Updates the specified item attributes # # Uses `SetItemField` if value is present and `DeleteItemField` if value is nil