KMail setup for outlook.com - "Failed to process EWS request"

Hi folks, I’m trying to add my Outlook.com 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 Outlook.com 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.

Domain: outlook.com
Username: my.full.email@outlook.com
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.

microsoft has announced they’ll go oauth2-only as of september 2024. it may become important to get the EWS OAuth2 mechanism working before then.

NM, i’ve switched from outlook dot com to mailbox dot org which doesn’t need oauth2.

Indeed. At Qt, we have office365, and oath is required now, with Microsoft Authenticator as a second factor. And I just get “authentication failed” in the client applications, even though the popup browser window where I log in seems to succeed (after Authenticator pops up on my phone, just as it does with macOS mail etc.)

i switched to mailbox-dot-org and all is now well (native IMAP, no weird EWS stuff.) of course i run my own primary mail server, but i need calendar integration and that’s hard to build out of open source componentry.