我正在尝试使用Exchange Web服务托管API从特定邮箱(我有权限)中检索收件箱项目.我首先使用我自己的电子邮件地址通过AutodiscoverUrl测试了代码,它运行正常.但是,当我尝试使用其他电子邮件地址时,EWS仍会检索我自己的收件箱项目.这是由于缓存还是什么?
我的代码如下:
ExchangeService ex = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
ex.AutodiscoverUrl("someothermailbox@company.com");
FindItemsResults<Item> findResults = ex.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
foreach (Item item in findResults.Items)
Console.WriteLine(item.Subject);
Run Code Online (Sandbox Code Playgroud)