ExchangeCalendar / exchangecalendar

Exchange Calendar, Tasks, Contacts provider for Mozilla Thunderbird
GNU General Public License v3.0
677 stars 57 forks source link

X-AnchorMailbox Field #197

Open Lantizia opened 6 years ago

Lantizia commented 6 years ago

So first of all, don't expect me to explain this very much more than I'm about to. I generally abhor anything Microsoft and try not accumulate any more knowledge about their offerings than I need to. In this case I'm forced to use Office 365 at my place of work.

I wrote a little BASH script for synchronising the annual leave of our employees (as recorded in an irritatingly bad MS-SQL/C# mess of an application our parent company uses) with one of our 365 Public Folder Calendars via EWS. It was all working until 31st August this year. At the same time this Thunderbird add-on also stopped working for using public folder calendars.

After much faff (it's a British term, look it up)... it eventually boiled down to finding these links (the github one I've participated in)...

https://github.com/OfficeDev/ews-managed-api/issues/204#issuecomment-424602366

https://social.technet.microsoft.com/Forums/en-US/ee6e943f-e103-4abf-957f-19a42aa8a91b/ews-with-o365-has-been-broken-for-the-past-24-hours-for-us?forum=onlineservicesexchange

From what I understand. At some point on 31st August the European 365 servers had a bit of a reshuffle and some mailboxes ended up on different servers to others. Since the root of the Public Folders is tied to a mailbox (something that took a while to twig with me) I kept getting messages back from EWS that either the items I was looking for didn't exist or that the information it attempted to retrieve was out of date.

The trick is apparently to set X-AnchorMailbox as a HTTP header and set it to the SMTP/mailbox address that the public folder root uses. In my case I've just blindly guessed what it is, but apparently powershell can tell you (as the Office 365 exchange admin centrer seems to lack the detail when you find that object).

But I've found that once I'd set it using my BASH script. Any further requests with my BASH script (and also this Thunderbird add-on) didn't need to send it again... it just magically worked from that point onwards. I'm guessing probably because on the 365-side of things it has realised that my mailbox and the public folder root mailbox ought to be on the same server.

advancingu commented 5 years ago

Did you ever see this issue again? Personally, I haven't seen any errors with public calendars on European Office 365.

Lantizia commented 5 years ago

No but I get the impression (from the MS advisers I was dealing with when trying to resolve the issue) that MS-made implementations of EWS clients do specify X-AnchorMailbox in order to properly latch onto the correct server where the calendar is (i.e. the one with the right root public folder mailbox).

Presumably I won't need to do the above again - until MS have another reshuffle and our company mailboxes get migrated elsewhere again (which would otherwise be unknown to us as to be actually happening).