Admittedly it can be a headache setting up the Microsoft service, here's a few things to check.
If you're using a Microsoft Personal email account like outlook.com, hotmail.com etc you'll need a slightly different setup to Office 365.
We tested the Personal account connection with these permission settings to get it working in the Azure Portal > Microsoft Entra ID > App Registrations.
During testing we configured the following permissions and ensured Grant Admin consent for all.
Microsoft Graph (7 Delegated permissions)
- email
- IMAP.AccessAsUser.All
- Mail.Read
- MailboxFolder.Read
- offline_access
- profile
- User.Read
You need to ensure you're using the Application (client) ID
You need to ensure you've added and matched the same redirect URL in the App as is in Azure, Authentication > Platform Configuration, usually http://localhost:8080
You'll need to ensure the Authentication > Supported Account Type is "Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)"
For Microsoft Office 365 Accounts, the settings are pretty much the same as above however we used these permissions in testing successfully:
Microsoft Graph (6 Delegated permissions)
- IMAP.AccessAsUser.All
- Mail.Read
- Mail.ReadWrite
- MailboxFolder.Read
- offline_access
- User.Read
In the App Registrations we ensured that the accounts needing access were added: App Registrations > "Your App Name" > Owners
For both Microsoft account type set ups, all you should then require for ExportEmails to work is your:
- Email Address
- Application (client) ID
- Redirect URI