无法访问公用文件夹根目录

发布于 2024-08-27 00:42:54 字数 1351 浏览 4 评论 0原文

我最近使用 C# 编写了一个 .NET 控制台应用程序。其目的是读取特定文件夹中的电子邮件,解析它们以获取特定值并将它们保存到数据库中。

在我最初编写此代码时,我们的电子邮件系统是 Exchange 2003。但是,我意识到我们很快就会升级到 Exchange 2010:因此,我构建的代码可以在这两种环境中工作。

然而,迁移到 Exchange 2010 后,该应用程序出现故障。

该应用程序使用 EWS API 来实现 2010 功能。当它尝试使用 ExchangeService 的 FindFolders 方法查找 publicfoldersroot 时,会引发异常。代码如下:

ExchangeService service = new ExchangeService();
FindFoldersResults findRootFldrs;

service.UseDefaultCredentials = true;
service.AutodiscoverUrl("[email protected]", delegate(string x) {
return true; });

FolderView fview = new FolderView(100);
fview.Traversal = FolderTraversal.Deep;

findRootFldrs = service.FindFolders(WellKnownFolderName.PublicFoldersRoot, 
fview);

异常:ErrorInvalidSchemaVersionForMailboxVersion,又名:

请求的邮箱不支持指定的RequestServerVersion

我尝试过的指定RequestServerVersion:

  • 将交换服务设置为2007(引发异常:“发生内部服务器错误。操作失败。”)

  • 授予自己对公用文件夹的最高级别权限(无效)

  • 手动设置我的凭据(无效)

我可以在 Outlook 2007 中查看公用文件夹; publicfoldersroot 属性在智能感知中可用;该代码适用于本地文件夹(我可以解析我的收件箱)。

我目前的想法是,这是 Exchange 2010 最近设置的一个设置:不幸的是,这不是我的领域。该异常告诉我它正在尝试使用以前版本的 Exchange。将其设置为 2007 只会导致代码因内部服务器错误而失败。

I've recently coded a .NET Console app using C#. It's purpose was to read the emails within a specific folder, parse them for specific values and save them to a database.

Our email system, at the time I originally coded this, was Exchange 2003. However, I was made aware we would soon be upgrading to Exchange 2010: ergo, I built the code to work in both environments.

Following the migration to Exchange 2010, however, the app has broken.

The app uses the EWS API for 2010 functionality. When it attempts to use the ExchangeService's FindFolders method to find the publicfoldersroot, it throws an exception. Here's the code:

ExchangeService service = new ExchangeService();
FindFoldersResults findRootFldrs;

service.UseDefaultCredentials = true;
service.AutodiscoverUrl("[email protected]", delegate(string x) {
return true; });

FolderView fview = new FolderView(100);
fview.Traversal = FolderTraversal.Deep;

findRootFldrs = service.FindFolders(WellKnownFolderName.PublicFoldersRoot, 
fview);

The exception: ErrorInvalidSchemaVersionForMailboxVersion, aka:

The mailbox that was requested doesn't support the specified RequestServerVersion

I've attempted:

  • Setting the exchangeservice to 2007 (throws an exception: "An internal server error occurred. The operation failed.")

  • Giving myself the highest level of permission to the Public Folder (no effect)

  • Manually setting my credentials (no effect)

I can view the public folders in Outlook 2007; the publicfoldersroot property is available in the intellisense; the code works on local folders (I can parse my inbox).

My current thinking is that it's a setting on the recent setup of Exchange 2010: unfortunately that isn't really my field. The exception tells me it's trying to use a previous version of Exchange. Setting it to 2007 simply causes the code to fail with an internal server error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

醉生梦死 2024-09-03 00:42:54

老帖子,但这对我来说是答案:http://technet .microsoft.com/en-us/library/bb629522.aspx

本质上,用于连接 EWS 的帐户在邮箱数据库中拥有一个邮箱,其默认公用文件夹服务器仍然是 Exchange 2003。枚举公用文件夹的所有尝试EWS 上的文件夹失败。将其更换为 2010 年的后端服务器后,问题立即得到解决。

Old post, but this turned out to be the answer for me: http://technet.microsoft.com/en-us/library/bb629522.aspx

Essentially the account used to connect with EWS had a mailbox in a mailbox database whose default public folder server was still Exchange 2003. Any and all attempts to enumerate public folders over EWS failed. Swapping it out for a 2010 backend server cured it instantly.

秋意浓 2024-09-03 00:42:54

您是否尝试过 esb.RequestServerVersion.Version = < a href="http://msdn.microsoft.com/en-us/library/exchangewebservices.exchangeversiontype.aspx" rel="nofollow noreferrer">ExchangeVersionType。 Exchange2010(或SP1)

北音执念 2024-09-03 00:42:54

将此行:更改

ExchangeService service = new ExchangeService(); 

为类似以下内容:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

取决于您的版本。

Change this line:

ExchangeService service = new ExchangeService(); 

to something like this:

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);

or

ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);

Depending on your version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文