Fog Creek Software
Discussion Board

Last ditch effor: Accessing Exchange Mailboxes

Perhaps you all can help me. I've posted this question to MS's forums to no avail, so I hope the great minds that read this blog can help:

Does anybody know of a good solid example in VB 6 of
how to access a Exchange 5.5 inbox of a different user
from the one currently logged in? I can write code all day
to log in to exchange as the current user, but what if you
simply need to supply the user name/pw of a different
network user and read that inbox. This seems like such a
simple task, but nobody has provided any examples.

This will be done either via  a web app, or a windows service. I need the option of checking multiple mailboxes belonging to multiple users.

Any ideas?


Thursday, June 5, 2003

A linked question. I have a mailbox to which I have delegate access. I wish to create a new contacts form from an Access data base and populate it with data and save the form to the shared mailbox contact folder..

It's trivial to do with a .pst file, but I'm not so sure about the details if the contacts folder is on a mailbox with delegate access.

Stephen Jones
Thursday, June 5, 2003

If you use CDO 1.21 you can logon to mailbox of any user as long as you have correct access rights. CDO 1.21 is not installed by default, but you can install it either from Office (it's an option under Outlook) or by installing Exchange (just installing Exchange Admin is enough in 5.5). I would recommend using the latest versions (e.g. Office XP or Exch 5.5 SP4).

To access a mailbox of another user use Session.Logon and pass "server" & "mailbox" for the profileInfo argument (the last arg). If you are going to do this from IIS or another service make sure that the service is running as a user that has permissions to access mailboxes in Exchange.

The documentation on CDO is pretty good once you know which flavor of CDO you need.

Thursday, June 5, 2003

Igor, i use the following:

objMapi.Logon ProfilePassword:="password", ShowDialog:=False, NewSession:=True, NoMail:=True, ProfileInfo:="mail" & vbLf & "The MailboxName"

And i still get access denied. The mailbox and password are correct, and I can even add these mailboxes to my own outlook account, but using cdo 1.21 i cant open the mailbox remotely.  I can however, open my own assigned mailbox using that code...

If i move that code to another machine logged in a different user, i get the same access denied error...


Thursday, June 5, 2003

It might be worthwhile to spend 10 minutes trying to use one of these tools: to see if they show you the other mailboxes you have permission to. 

If the tools also fail then there may be some config issue on the server side.  If they work then you can blame your code :)

Steve H
Thursday, June 5, 2003

Steve H, thats the thing. Im not trying to access mailboxes that are "owned" by me, but those which are owned by a totally different network user than the one logged in..

Thursday, June 5, 2003

I don't know if this article will give you any help

It appears that the dialog box cannot be set to no without causing an error message

Stephen Jones
Thursday, June 5, 2003


a website which i've found a fair bit of useful stuff in the past relating to CDO stuff is . They've just changed their website to be more of a commercial site, but the info is still there.

Hope it helps.

Friday, June 6, 2003

*  Recent Topics

*  Fog Creek Home