我試圖從特定郵箱(我有權限)中使用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