Office 365 is Microsoft's online office suite which includes an Email service. Traditionally one would access it with Microsoft Outlook locally or on in the web browser.
KMail has two methods of accessing Office 365.
Be aware, sometimes this doesn't work at all and you keep getting an authentication error.
In your Outlook settings search for IMAP or POP to find the servers and settings you need to use.
Most likely they will look like
For your username enter your full email address and then enter your password.
Settings dialog for Office 365
Advanced settings for Office 365 IMAP
This will give you access to all your calendars and contacts as well. Unfortunately there's a bug that makes it a little cumbersome to setup, but it works nonetheless.
Select "Custom account" on dropdown
Select "EWS" to start creating an Exchange account
- Enter your full email
- Fill out the authentication with any information you like (workaround for the above mentioned bug)
- Now change to Oauth2(Office 365)
- Set the EWS URL to https://outlook.office365.com/ews/exchange.asmx
You should be greeted with a popup asking you to enter your credentials. Once all is done you can then select what to sync e.g Agenda, Email (which folders), Contacts, etc.