无法访问某些计算机上的用户Exchange邮箱

时间:2019-06-17 14:18:57

标签: c# outlook exchange-server exchangewebservices

我试图以我自己的用户身份运行以下代码。

var email = UserPrincipal.Current.EmailAddress;
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.AutodiscoverUrl(email);
FolderId inbox = new FolderId(WellKnownFolderName.Inbox, new Mailbox(email));
service.FindItems(inbox, new ItemView(1000));

此代码在一台机器上有效,但不适用于新机器。相反,我得到了这个异常

Microsoft.Exchange.WebServices.Data.ServiceResponseException was unhandled
  HResult=-2146233088
  Message=The specified object was not found in the store., The process failed to get the correct properties.
  Source=Microsoft.Exchange.WebServices
  StackTrace:
       at Microsoft.Exchange.WebServices.Data.ServiceResponse.InternalThrowIfNecessary() in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Responses\ServiceResponse.cs:line 277
       at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute() in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\Requests\MultiResponseServiceRequest.cs:line 166
       at Microsoft.Exchange.WebServices.Data.ExchangeService.FindItems[TItem](IEnumerable`1 parentFolderIds, SearchFilter searchFilter, String queryString, ViewBase view, Grouping groupBy, ServiceErrorHandling errorHandlingMode) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\ExchangeService.cs:line 832
       at Microsoft.Exchange.WebServices.Data.ExchangeService.FindItems(FolderId parentFolderId, ViewBase view) in \\REDMOND\EXCHANGE\BUILD\E15\15.00.0913.015\SOURCES\sources\dev\EwsManagedApi\src\EwsManagedApi\Core\ExchangeService.cs:line 956

除了

,我看不到其他机器之间的任何差异
  • 故障机器是新安装的,因此它可能缺少某些框架组件或某些东西?
  • 我在发生故障的计算机上没有管理员权限,但是我在两台计算机上都没有以管理员身份运行。
  • 发生故障的计算机已安装Outlook 365,而工作计算机已安装Outlook 2013。我不确定为什么这会是个问题,因为他们俩都在同一个Exchange服务器上通话。

真正令人困惑的是,我在Outlook中的“帐户设置”下配置了两个帐户(第二个是服务帐户邮箱)。如果我将email变量更改为第二个帐户的电子邮件地址,则一切正常。这使我相信这绝对不是管理员权限的问题,但是我不太清楚问题是什么。

0 个答案:

没有答案