2

I have a C# program that connects to my Exchange Server 2010 and is able to read every email.

I am using the microsoft.exchange.webservices.dll library.

The problem is, that this program gives back the following exception on Exchange Server 2013: "The remote server returned an error: (501) Not Implemented."

I have no idea what's the difference between these 2 servers.

Edit: Some Code Snippets:

ExchangeVersion version = ExchangeVersion.Exchange2013; ExchangeService service = new ExchangeService(version); service.Credentials = new NetworkCredential("user", "pw", "domain"); service.AutodiscoverUrl("emailaddr");

and here happens the exception:

SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));

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

service.LoadPropertiesForItems(findResults.Items, PropertySet.FirstClassProperties);

string mailsender = item.LastModifiedName;

xileb0
  • 451
  • 2
  • 6
  • 18
  • 1
    Please show us the code you are using where the error is. It's possible that your code is only targeting Exchange Server 2010 – Our Man in Bananas May 21 '15 at 20:01
  • 1
    I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders May 21 '15 at 20:02
  • @JohnSaunders: I was wondering also about the `Exchange Server` but decided to leave it and missed entirely the `c#` – Our Man in Bananas May 21 '15 at 20:09
  • 1
    @OurManInBananas: I felt that "Exchange Server 2013" was an adjective phrase qualifying "Email Driver". Q: "What kind of email driver?" A: "Exchange Server 2013 Email Driver". – John Saunders May 21 '15 at 20:47
  • @xileb0: do you have this code in your initialization of EWS: `ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);// ` ? – Our Man in Bananas May 22 '15 at 11:11
  • 1
    Probably a mismatch between server and EWS assembly version, is it the latest one from NuGet? Does it have an SP1 option in the ExchangeVersion enum? – Charleh May 22 '15 at 11:30
  • Does it work if you just do a normal ItemView with no filter? Just wondering if what you are doing with your search filter is causing an issue (not that it looks like you are doing anything strange...) – Charleh May 22 '15 at 12:34
  • Throws the same exception if i do this: `FindItemsResults findResults = service.FindItems(WellKnownFolderName.Inbox, new ItemView(10));` – xileb0 May 22 '15 at 12:49
  • It looks like whatever I'd like to load from the mailbox, this exception occurs. Just tried to find a folder. Same thing... But why? – xileb0 May 22 '15 at 13:35
  • @xileb0: when you type `ExchangeVersion` then the period (or full-stop in *GB English*) what are the available options? – Our Man in Bananas May 22 '15 at 14:14
  • A little update: I tried this tool: https://ewseditor.codeplex.com/ It is able to show me all the information of the server, but when I try to open a message folder it shows the same exception. – xileb0 May 27 '15 at 07:03
  • I think i am close to the solution: I am already able to display mails from the inbox. The problem is, whenever I use `item.Load()`, or `item.Delete(DeleteMode.HardDelete)`, the 501 expection still occurs. Do you have any ideas? – xileb0 May 27 '15 at 13:55
  • Guys, I actually found the problem: When I use the Fiddler Web Debugger to check the communication between Client and Exchange Server and activate "Decrypt HTTPS traffic" in the options, my program works without any problems. When I close Fiddler, the problem returns. How would you handle that? – xileb0 May 28 '15 at 08:44

1 Answers1

0

Finally found the problem:

There was a load balancer between exchange server and my server. I'm bridging this load balancer now -> Works perfectly

xileb0
  • 451
  • 2
  • 6
  • 18