EWS 2010: Public Folder Problem using .NET

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-03-23T17:29:59Z Indexed on 2010/03/23 17:33 UTC
Read the original article Hit count: 765

Filed under:
|
|
|
|

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 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;

if (findRootFldrsSub == null)
{
//Set to root to test local folders --

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

The exception:

"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; 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.

© Stack Overflow or respective owner

Related posts about ews

Related posts about exchange