Logging into hosted Exchange account with Basic Authentication

O

OutlookIssueMan

I have a program that runs on a server that uses Redemption to log into the
default profile without a password and do some work, like accessing the
Global Address List, access folders & items (including folders from other
mailboxes with appropriate permissions), etc. The code looks like this:

RDOSession session = new RDOSession();
session.Logon(missing, missing, false, true, missing, missing);

When we're using an internal Exchange server, this works fine. This is
probably because we setup the default profile with the Exchange account
interactively first and ask it to save the password for us.

However, we have a few customers who use a hosted Exchange provider. Those
accounts use Basic Authentication, which will not allow you to save the
password. We tried setting a password in the second parameter of the Logon
call, but realized that it's an old "profile password" and did not work.

Assuming we would store the encrypted credentials, is there still a way to
accomplish this? I've seen a few notes mentioning passing a server name and
the mailbox name separated by CR/LF (dynamic profiles?) along with
impersonation, but don't know anything about this. Can someone tell me if
we're on the right track and perhaps point me to some resources? Thanks in
advance.

Michael
 
D

Dmitry Streblechenko

Make sure the third parameter (ShowDialog) is true: Exchange provider always
uses the identity of the current user to authenticate with the server. If
you are not logged in as the domain Windows user who owns the rpimary
mailbox in the profile, you wiwl get an authentication dialog.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
O

OutlookIssueMan

Yes, we were aware of the ShowDialog parameter, but in this case we are on a
server where there is no user to enter the password. We would like to store
the credentials in an encrypted form in our application and then use them
each time we need to log into MAPI. However, we're not sure how to get the
credentials to MAPI.

Michael
 
D

Dmitry Streblechenko

You can't - EX provider always uses the identity of the current Windows
user.
You can use impersonation, but it does not play too well with MAPI. Or you
can spawn a new process under the identity of that user.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
O

OutlookIssueMan

So, I just want to be clear. From this information, it looks like there is
no way for a non-interactive program (like a service) to do a MAPI logon to
a hosted Exchange account (or any account using Basic Authentication) even
if it knows the credentials to log in. Is that correct?

Michael
 
D

Dmitry Streblechenko

You can launch a process in the context of the mailbox owner. That process
can then connect to the mailbox.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
O

OutlookIssueMan

I don't think that is possible with a hosted Exchange server. The mailbox
owner is not within my company, it is on the hosting company's computers.
When we try to authenticate on the Exchange proxy server, it asks for a
username and password that have nothing to do with user's at my location.
In fact, the username's on the two accounts I have been working with (two
different hosting companies) both have characters that are illegal in a
Windows username (@, for instance) and one of the accounts is longer than
the 20 character limit for usernames as well.

So, how would I create a process on my computer that was in the context of
the account on the hosted Exchange provider's machine?

Michael
 
D

Dmitry Streblechenko

If you cannot add the mailbox owner to the list of the local users, I don't
think there is anything you can do.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top