I followed this article and created a new Console App.
I generated my App Id
, Tenant ID
and Client secrete
as mentioned in the article.
With it, I am successfully able to generate authResult.AccessToken
But it fails to read Items or Folders at the below code.
var folders = ewsClient.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(10));
foreach(var folder in folders)
{
Console.WriteLine($"Folder: {folder.DisplayName}");
}
Any guidance is greatly appreciated.
I faced this same issue 2 days ago. The issue was that the application was registered in Azure following "Configure for delegated authentication" as in the Microsoft article https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth#configure-for-delegated-authentication
If you are using this as an API you will need to follow the section named Configure for app-only authentication in the same link above to make it work. Please check and let me know if it will work.
You may need to delete the first registered application you did and create a new one, then start everything again following the documentation
That worked for me.