Nov 14 2016

VB.Net application unable to connect to some Exchange 2010 mailboxes

We had an interesting issue last week where a Visual Basic .Net application could connect to some mailboxes but could not connect to other mailboxes on Exchange 2010. The application uses MAPI to connect to the mailboxes.

We were however able to access the affected mailboxes using Outlook and with the MFCMAPI tool from the application server. We moved the affected mailboxes to other servers and databases but the application could still not connect to the affected mailboxes. We then added our CAS Array name and IP in the application server’s host file and checked the Exchange RCA logs.

We could not see any connections from the application server to the affected mailboxes but could see connections to the working mailboxes in the RCA logs.

The error from the application were as below but note that it was misleading as it stated it authenticated, connected but could not expand the mailbox store.

ProcessMails() LogonExchangeMailbox Success
Date Time : 2016-11-07 06:30:17
Error : Error in IMAPISession::OpenMsgStore: MAPI_E_FAILONEPROVIDER
ulVersion: 0
Error: The information store could not be opened.
Component: MAPI 1.0
ulLowLevelError: 0
ulContext: 649
Source : at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at MailReader.Form1.ProcessMails(String sToDoFolder, String sDuplicateToDoFolder, String sTiffFolder, String sDuplicateTiffFolder, String sExchangeServer, String sInboxUser, String sInboxName, Int32 maxItems, Int32 branchRef)

We then resolved the issue by doing the following:

  • Opened Exchange Management Shell
  • Ran this cmdlet against a working mailbox:¬†get-mailbox |fl *legacy*
  • Made a note of the output
  • Ran the above cmdlet against a non working mailbox and compared the outputs.

The output of the working mailbox:

ServerLegacyDN : /o=yourdomain/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=MailboxServerName
LegacyExchangeDN : /o=yourdomain/ou=exchange administrative group (fydibohf23spdlt)/cn=recipients/cn=MailboxAlias

The output of the non working mailboxes:

ServerLegacyDN : /o=yourdomain/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=MialboxServerName
LegacyExchangeDN : /o=yourdomain/ou=SomeOU/cn=recipients/cn=MailboxAlias

The fix:

We then used AD Attribute Editor to change the LegacyExchangeDN on non working mailboxes (LegacyExchangeDN : /o=yourdomain/ou=SomeOU/cn=recipients/cn=MailboxAlias) to reflect the working mailboxes’ LegacyExchangeDN (LegacyExchangeDN : /o=yourdomain/ou=SomeOU/cn=recipients/cn=MailboxAlias)

Waited for replication and the application could once again access all the required mailboxes.