Overview
When configuring a Microsoft Exchange Online external mail source in M-Files Admin, you may receive the following error after attempting to save/apply the configuration:
Test connection failed. Communicating with the mail server “outlook.office365.com" failed. Selecting a mail folder failed. Getting a list of mail folders failed. (Listing folders failed. One or more errors occurred. Code: ErrorAccessDenied Message: Access is denied. Check credentials and try again.
This error will occur even after confirming the correct Tenant ID, Client ID, and Client Secret are in place.
Solution
Given that this is an access issue, the likely culprit is the API Permission settings in Azure AD. Ensure that the API Permissions are set exactly as noted in section 5 of the configuration guide here: Azure Portal Configuration for Microsoft Exchange Online as External Mail Source (site.com)
Specifically, when adding the Microsoft Graph permission, you must add the Mail.ReadWrite permission as an Application permission, do NOT add it as a Delegated permission as this will cause the AccessDenied error.
