Lots of companies, including ours, wont allow a basic username/password login for an Office365 account. Instead there's a usecase here for using client_id and client_secret for authenticating. If using exhangelib it should be able to be used using OAuth method: https://ecederstrand.github.io/exchangelib/#oauth-authentication.
I haven't tired doing this with exhangelib, but in the past I've used https://pypi.org/project/Office365-REST-Python-Client/ library which is easy to use when needing to use client credentials instead of username/password.
If I ever get some time in the next 10 years I'll try to contribute something.
Lots of companies, including ours, wont allow a basic username/password login for an Office365 account. Instead there's a usecase here for using client_id and client_secret for authenticating. If using exhangelib it should be able to be used using OAuth method: https://ecederstrand.github.io/exchangelib/#oauth-authentication.
I haven't tired doing this with exhangelib, but in the past I've used https://pypi.org/project/Office365-REST-Python-Client/ library which is easy to use when needing to use client credentials instead of username/password.
If I ever get some time in the next 10 years I'll try to contribute something.