When implementing this with multiple customers we repeatedly ran into the issue that the Exchange Online / Azure team did not follow the Oracle documentation by the letter. Especially keep note of the sentences written in BOLD. Oracle has done a great job in writing this document, however still in more than 50% of the customers I've been working with errors have been made.
There is a quite good way to troubleshoot though. Basically, you have to download OAuthIMAPTest.class from 2860542.1 and can then run something like:
source /u01/install/APPS/EBSapps.env run;
$AFJVAPRG -classpath .:$AF_CLASSPATH OAuthIMAPTest wf-ebs-entw@customer.de d0b7d37d-9b04-4b05-aadf-a9fc74614d18 https://login.microsoftonline.com/f9a4fdf3-3ad9-4855-b1b1-b96763b022c1/oauth2/v2.0/token https://outlook.office365.com/.default 31065893 31065894 secret $FND_SECURE/$TWO_TASK.dbc MicrosoftOffice365ExchangeOnline
The magic numbers are the .p12 and the .cer file (in that order) file_ids that you can find as follows:
select file_name,file_id from fnd_lobs where file_name like '%p12' or file_name like '%cer';
If all goes well that should end with:

Successful connection
If something goes wrong with that tool you get at least some better errors than through the "Test" in the UI.