I have a console application written in c# which we use to connect to outlook mailbox using exchange service to read the emails from the inbox. Recently, we have migrated to Azure AD with MFA and after that change, my code is throwing 401 Unauthorized error. Can anyone suggest a workaround to authenticate the console to connect and read mail without any user dependency.
Normal WebClient function which uses username and password to connect to outlook. https://outlook.office365.com/EWS/Exchange.asmx is used as the Service object url in code.