Exchangelib is a Pyhton library where you can develop Python script that need to interact with Exchange. One of the use case for me is to develop a test script to troubleshoot connection to Office 365 using EWS + oAuth2
The script below will need the following information and you will also need to register your application with Microsoft Azure.
Tenant ID, Client ID, Client Secret: After your app is registered successfully, these information can be obtained from Azure.
Primary SMTP Address: Your email address that use for this integration
Exchange Web Service URL: This guide help you to identify your URL
The script will have debug mode enabled so you can see all the information when the script is run. It will print out total item in your inbox and also send out a test email.