KMail setup for - "Failed to process EWS request"

Hi folks, I’m trying to add my account for mail, contacts and calendar and I’m struggling to get past the error Failed to process EWS request - HTTP code 401.

I’ve been following the Kmail documentation for Office 365 including the workaround to supply some “dummy” credentials in the username/password section before choosing OAuth2.

This worked successfully for a different Office 365 account. However when I try this for my account it successfully goes through the OAuth2/MS Authenticator flow then fails with the below dialog box.

I’m using Kmail Version 5.22.3 (22.12.3) from Debian bookworm. Does anyone have any ideas? Cheers!

Note that IMAP works but it’s not the solution I’m going for here. I want to sync KAddressBook and KOrganizer too.

I can at least partially answer my own question: it’s possible to use the Username/Password option here using an App Password created through MS account settings.

Password: app_password_goes_here

It’s now syncing mailboxes through EWS. Sadly no luck yet with calendar/contacts; I keep getting notifications that an akonadi process is crashing while traversing the resources on my account. I don’t know for sure whether this would work better with OAuth2 but I suspect it’s a separate issue.