EwsException-Message "Too many folders in response." when accessing an existing folder.

0 votes
asked Jan 7 by christian.harter (290 points)
edited Jan 7 by christian.harter

Hello,

I have a problem when accessing an EWS folder.
Connect and Login succeed. GetFolderList also succeed and delivers the folders of the mailbox. When accessing that folder the EwsExcption below is raised.

var client = new Ews();
client.Connect("xxxxxxxxxxxx", SslMode.Implicit);
client.Login("user", "pw");

foreach (var fi in client.GetFolderList(EwsFolderId.Root)) {
  if (fi.Name == "INBOX") {
    Console.WriteLine("Try open in loop ...");
    var f = client.FindFolder(fi.ParentId, fi.Name);
  }
}

Result: EwsException-Message "Too many folders in response." (ProtocolCode and ProtocolMessage are null.

Is this a known issue?
Do you have any tipps to handle this problem?

Thank you and best wishes,
Christian

Applies to: Rebex Secure Mail

2 Answers

0 votes
answered Jan 7 by Pavel Matyska (13,300 points)

Hello,

The exception says that the Exchange server returned more than one folder records while we expect one or zero record to be returned. Is there another folder that contains "INBOX" in its name as well? You can see it in a log. You can log the communication as described in our KB article.
Actually, what are you trying to achieve? If you want to get information about your Inbox folder, you can get it directly by calling

client.GetFolderInfo(EwsFolderId.Inbox);

or if you want to get each folder in a loop, you should get it by calling

client.GetFolderInfo(fi.Id);

It should be less resource consuming for the Exchange server rather than finding folder by its name.

0 votes
answered Jan 7 by christian.harter (290 points)

Hello,

I'm sorry. The snipped was just a sample. It doesn't represent what I am going to achieve.
In a config file I define which folder should be processed. So I have to use client.FindFolder(EwsFolderId.Root, "INBOX");
The loop should show that I am accessing a folder that definitly exists.
GetFolderInfo(Id of "INBOX") works.

Method client.GetFolderInfo(EwsFolderId.Inbox); raises EwsException Message "ErrorUnsupportedPropertyDefinition".

I've logged the communication when calling client.FindFolder(EwsFolderId.Root, "INBOX");. How can attach this log file? Obviously all 19 Folders will be returned in the SOAP response. INBOX is a part of the results. But 18 other folders too.

INBOX and all other folders are unique. No one of them can be found by FindFolder. Maybe a problem with that specific exchange server? I have not problems on other servers.

Thanks and best wishes,
Christian

commented Jan 7 by Pavel Matyska (13,300 points)
Hello,
You can send us the log file to support@rebex.net, but if you saw that the FindFolder operation returned 19 folders when specifying "INBOX" and only one is actually named "INBOX", it is something wrong with the exchange server. For sure if your application  behaves correctly with other servers.

Ews exception with "ErrorUnsupportedPropertyDefinition" should be also seen in a log, it came from your exchange server. Can you please send this log with this specific exception to us? It seems that we sent some EWS property that is not valid for your version of Exchange server.  What version is that server?

Thank you for letting us know
Pavel
commented Jan 7 by christian.harter (290 points)
Log files were send to support@rebex.net .
Thank you.
...