[英]Microsoft.Exchange.WebServices.Data.ServiceResponseException: Unable to access an account or mailbox
[英]How do I search a specific mailbox with Microsoft Exchange WebServices?
我有自己的郵箱 (email-1),我工作組中的每個人都可以訪問郵箱 (email-2)。 我需要在 email-2 中搜索電子郵件,但它正在從 email-1 返回電子郵件。
using Microsoft.Exchange.WebServices.Data;
service = new ExchangeService(ExchangeVersion.Exchange2013_SP1)
{
UseDefaultCredentials = true,
Url = new Uri("https://fake.com/ews/Exchange.asmx")
};
mailbox = new Mailbox("email-2@fake.com");
ItemView view = new ItemView(50)
{
PropertySet = new PropertySet(BasePropertySet.IdOnly)
};
view.PropertySet.Add(ItemSchema.Subject);
FindItemsResults<Item> items = service.FindItems(WellKnownFolderName.Inbox, "searched value", view);
它只從 email-1 返回電子郵件,但沒有從 email-2 返回。 我需要它只返回來自 email-2 的電子郵件。
我還沒有找到任何方法來指定要在 FindItems function 中搜索的郵箱。 也許我錯過了什么?
你能試試嗎
service.FindItems(WellKnownFolderName.Inbox, mailbox.ToString(), view);
我以前遇到過同樣的問題,現在我找不到該代碼來驗證。 我從這個博客中得到了答案。 https://blog.kloud.com.au/2016/04/19/programmatically-read-email-from-an-exchange-sever-mailbox
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.