Search code examples
exchange-servermapioutlook-redemption

Why am I receiving the 401 HTTP ERROR when calling GetSharedMailbox in Redemption?


I am using Redemption to access the shared mailboxes. The Logon method that I am using is Session.LogonExchangeMailbox.

It seems to be working fine as long as I do not try to access the shared mailbox. Once I am trying to access shared mailbox, there is the following error:

Redemption.RDOStores: Could not find the store DN Could not retrieve autodiscover XML: GetAutodiscoverForEmailAddress: There are no autodiscover servers in the AD for this address Error in WinHttpSendRequest(bcg.com/autodiscover/autodiscover.xml): ERROR_WINHTTP_TIMEOUT Error in WinHttpSendRequest(bcgcloud.mail.onmicrosoft.com/autodiscover/autodiscover.xml): ERROR_WINHTTP_NAME_NOT_RESOLVED Error in WinHttpSendRequest(autodiscover.bcgcloud.mail.onmicrosoft.com/autodiscover/autodiscover.xml): ERROR_WINHTTP_CANNOT_CONNECT HTTP error 401 from https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml

What I tried:

  1. adding credentials with RDO.Credentials.add - does not change anything
  2. LogonHostedExchangeMailbox - does not work in my case at all - I guess because of Basic Auth being disabled (and I cannot get OAuth token for modern auth)

Checking the server version with Session.ExchangeMailboxServerVersion has shown that we have 15.20.4995.8 - looks like we have Exchange 2019 where RPC-Over-HTTP is not supported anymore. Then the question would be how could Session.LogonExchangeMailbox work at all even with DefaultFolder? Why does it error out only in case, if I am trying to access sharedmailbox?

Thanks.


Solution

  • Redemption needs to retrieve autodiscover XML before it can open a shared mailbox. In most cases, autodiscover retrieval should still work with basic authentication, but opening the actual mailbox woudl still require OAuth token if basic auth is disabled. Is your code running in a COM addin or a standalone app?