我试图从特定邮箱(我有权限)中使用Exchange Web服务托管API检索收件箱项目。我已经使用自己的电子邮件地址通过AutodiscoverUrl测试了代码,并且它工作正常。但是,当我尝试使用其他电子邮件地址时,EWS仍然检索我的自己的收件箱项目。这是由于缓存或什么?使用C#中的Exchange Web Services托管API检索错误的邮箱项目
我的代码如下:
ExchangeService ex = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
ex.AutodiscoverUrl("[email protected]");
FindItemsResults<Item> findResults = ex.FindItems(WellKnownFolderName.Inbox, new ItemView(10));
foreach (Item item in findResults.Items)
Console.WriteLine(item.Subject);
谢谢,因为我有委托访问(并没有模仿权限)我做了你的第一个方法,它的工作! – communista 2012-02-13 05:33:15
节省!谢谢! – 2013-04-18 05:55:02
我花了太多时间来解决这个问题:1)确定包含目标邮箱的过滤器:'Import-Module ActiveDirectory; get-aduser -filter * |其中{$ _。samaccountname-like“bob”}',2)创建一个包含目标邮箱的管理作用域'new-ManagementScope -Name bob_targetuser -RecipientRestrictionFilter {samaccountname-like“bob”}'; 3)将范围分配给对象ACL:'New-ManagementRoleAssignment -Name appimpersonationrole -Role ApplicationImpersonation -User usernamethatisallowedImpersonzationrights -CustomRecipientWriteScope bob_targetuser' – mbrownnyc 2017-08-11 15:36:35