Hi everybody,
I need help with VB/CDO problem. I have two mail profiles on the same PC,
one is my regular work email account that uses the same UI and Password that
I use to login on the network lets call it "MyProfile1" and another account
that resides on the same mailserver but has different Userid and password.
I happen to know all the information for that account, and successfully create
profile for it on my PC and can browse it when I enter correct Userid, DomainName
and password when Outlook prompts me. Lets call it "Profile2". I setup Outlook
to use both of them on my PC, and I can use them one at a time no problem
the only difference is when I need to use "Profile2" I type in userid, domain
and password. Now is the problem.
I need to login to my second account via my VB programm. And when I go like
this:


Set oSession = New MAPI.Session
oSession.LogOn "Profile2", "password", False, True
Set oInfoStores = oSession.InfoStores

If Not oSession.CurrentUser = "Unknown" Then
Set cdsInfostore = oInfoStores("Mailbox - Profile2")
Set oInboxFolder = GetFolderByName(oSession, "Inbox", cdsInfostore)
Set oDataFolder = GetFolderByName(oSession, "DataFiles", cdsInfostore)
Set oErrorFolder = GetFolderByName(oSession, "ErrorFiles", cdsInfostore)
LogOn = True
Else
Set oSession=Nothing
End If

it always fails, since I cannot find the way to pass UserID. May be I donot
need to pass userid, but oSession.CurrentUser always return=”Unknown”, meaning
that I am not connected to the exchange server. I use to have another PC
with the userid and password for the network and uid/pwd for the mail account
are the same, and my program worked fine on that machine, but now I do not
have that luxury, and frankly I need to write program that can be run on
any machine
It works when I have outlook open with this account, but I cannot keep outlook
open all the time, it just stupid.
Please help, I cannot find good CDO newsgroup.
Thanks in advance.
Igor.