Open alex3683 opened 1 year ago
I fixed the bug. You are welcome to clone my fork, the only change is adding the booking element.
@SchultzAndreas Thanks for this. I ran into this as well, apparently when Booking is enabled on the account you can get this, did not see this before. I am running on a fork by @sherlock1982 so I added your fix to my own fork of that fork :-|
First a short note: I know that EWS for Exchange Online is discontinued and that MS Graph API should be used. We are going to switch to that, but it will take us some time. In the mean time we still have to support EWS for our customers. And I think the fix / Workaround could be quite simple, alas it can only implemented within the EWS managed API and not client code.
We observed the following symptom: Calling
ExchangeService.SyncFolderItems
failed for some users with the following exception and stack trace:I then asked the customer to provide an EWS Trace. This contained a lot of the well known
<t:CalendarItem>
elements, but far at the end an<t:Booking>
, which seems to come from Microsoft Bookings . In parallel I had a look at the source of the EWS managed API and looked for a spot, where the NRE could occur. This then fell into my eye: https://github.com/OfficeDev/ews-managed-api/blob/25a393dbc68b420d25999bdf0a03c23d86412f57/Core/Responses/SyncResponse.cs#L153-L155So in case
EwsUtilities.CreateEwsObjectFromXmlElementName<TServiceObject>
cannot provide an instance for the element it returnsdefault
(https://github.com/OfficeDev/ews-managed-api/blob/25a393dbc68b420d25999bdf0a03c23d86412f57/Core/EwsUtilities.cs#L309), so in practicenull
and https://github.com/OfficeDev/ews-managed-api/blob/25a393dbc68b420d25999bdf0a03c23d86412f57/Core/Responses/SyncResponse.cs#L157 will throw the NRE. And in fact no elementt:booking
is registered here https://github.com/OfficeDev/ews-managed-api/blob/25a393dbc68b420d25999bdf0a03c23d86412f57/Core/ServiceObjects/ServiceObjectInfo.cs#L66It seems that this library had the same issue: https://github.com/ecederstrand/exchangelib/issues/877
So my question is: What can we do, until we switch to Graph, to mitigate this? Is there any workaround we can implement on our side? Disabling Microsoft Bookings is no option. Honestly I fear there is no local workaround.
So would it be possible to provide a EWS managed API version that is more lenient in that regard and (maybe optionally) ignores new, unknown element types? The implementation would be quite simple. For me this just seems like a breaking change from Microsoft. We're quite stuck here ...
EDIT: This is what the Booking looks like, apart from the stuff after organizer much like a calendar item (XXXX where sensitive data was):