EWS 'account that does not have a mailbox' error on IIS

泄露秘密 提交于 2020-01-05 04:41:05

问题


I'm developing an intranet webpage for coorparation(I use windows authentication). Via this website users can see their mailbox. For this, I use EWS and everything works perfect on IISExpress. However when I publish to IIS server(which is on my computer) it gives this error: "When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids".

CODE:

    ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
    service.UseDefaultCredentials = true; 
    service.AutodiscoverUrl("user@xx.com");
    SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
    ItemView view = new ItemView(100);

    FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, sf, view);

What can be wrong,I'm looking for days but I couldn't find a solution?

来源:https://stackoverflow.com/questions/39634426/ews-account-that-does-not-have-a-mailbox-error-on-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!