Remove all occurrence exceptions when updating recurrence master with Exchange Web Service

Viewed 228

When I change the pattern of a reccurrence master appointment in Outlook all modified or deleted occurrences are reset.

I try to achieve the same behavior using EWS from .NET using Microsoft.Exchange.WebServices.dll. Unfortunately I did not found any option to remove the exceptions from an existing appointment. After calling item.Update all exceptions retain in Exchange unless they are completely out of range of the new recurrence pattern.

  • The collections ModifiedOccurrencesand DeletedOccurrences are read-only and do not provide a method to clear them.
  • The change of the Recurrence property seem not to cause this behavior automatically.
  • I did not find any item action method like "RemovePatternExceptions" or something like that.
  • I know that it is impossible to restore single ocurrences to their default (Delete an Exchange occurence modification / deletion in EWS)

How to restore all occurrences using EWS?

1 Answers

Short answer

After extesive inspection it turned out that
there is no direct way to do this via EWS, but a work around exists.

Details

Exchange server behavior

The EWS API provides no interface to restore existing exceptions.

Wenn an recurrence master is updated the EWS server only discard exceptions that are no longer valid with the new master, e.g. because they are out of scope due to end date changed. The exact behavior may depend on the Exchance version (untested). In my case it was Exchange 2016.

Outlook Web Access

Outloook web access seem to expose the native behavior of the Exchange server. If you do changes to the recurrence master, e.g. move the start date, a warning pops up that this will reset all occurrence exceptions. This warning ist wrong. The exceptions persist unless they have become invalid.

Outlook in contrast shows the same warning and really restores all occurences to their default.

Work around

The feature that Exchange removes invalid occurrence exceptions can be used to delete all of them.
Simple disable recurrence temporarily.

I.e. the appointment need to be updated twice. In the first call only the Recurrence property is cleard. The second update applies the intended changes.

item.Recurrence = null;
item.Update(ConflictResolutionMode.AutoResolve, SendInvitationsOrCancellationsMode.SendToNone);
// set Recurrence to the new value here and optionally adjust other properties
item.Update(ConflictResolutionMode.AutoResolve, invitationsMode);

To avoid duplicate change invitations to the attendees of meetings none are sent in the first step. It is essential that no further changes are made before the first Update call. Otherwise required invitations might be lost, e.g. to new or removed attendees.

Related