2

I got this error on an Exchange 2007 mailbox. I see it is returning the BAD response from the error which is thrown by MailKit:

The IMAP server replied to the 'EXAMINE' command with a 'BAD' response.

But this doesn't tell me enough detail. So I am running protocol logging, from which I can tell what the problem is. It says:

K00000005 BAD Duplicate folders "Conversation Action Settings", "News Feed", "Quick Step Settings", "Suggested Contacts" were detected in the mailbox. Therefore the user's connection was disconnected.

I would like to get this error text and display it to the user, so they can fix their mailbox (which they can do by deleting the duplicate folders, assuming they know which ones they are). Is there a simple way to get the full response text?

Full protocol log as follows:

S: * OK Microsoft Exchange Server 2007 IMAP4 service ready
C: K00000000 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
S: K00000000 OK CAPABILITY completed.
C: K00000001 AUTHENTICATE NTLM
...
S: K00000001 OK AUTHENTICATE completed.
C: K00000002 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=NTLM AUTH=GSSAPI AUTH=PLAIN IDLE NAMESPACE LITERAL+
S: K00000002 OK CAPABILITY completed.
C: K00000003 NAMESPACE
S: * NAMESPACE (("" "/")) NIL NIL
S: K00000003 OK NAMESPACE completed.
C: K00000004 LIST "" "INBOX"
S: * LIST (\Marked \HasNoChildren) "/" INBOX
S: K00000004 OK LIST completed.
C: K00000005 EXAMINE INBOX
S: K00000005 BAD Duplicate folders "Conversation Action Settings", "News Feed", "Quick Step Settings", "Suggested Contacts" were detected in the mailbox. Therefore the user's connection was disconnected.
S: * BYE Connection is closed. 15
mike nelson
  • 21,218
  • 14
  • 66
  • 75

1 Answers1

0

You can try parsing the ImapCommandException.Message property to get the text following the ':' character that is used in the exception message.

I've also just added a ResponseText property to ImapCommandException so you can get this text w/o needing to parse it if you want to use MailKit built source.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • I'm a bit confused, I think the ImapCommandException.Message is just this: `The IMAP server replied to the 'EXAMINE' command with a 'BAD' response.` – mike nelson Oct 11 '16 at 03:01
  • Then perhaps MailKit isn't properly capturing the error string. I'll look into it. – jstedfast Oct 11 '16 at 13:59
  • I've fixed this to properly capture the response text now. It was just dropping it before, probably because it was never used before. – jstedfast Oct 11 '16 at 14:37