Help with CDO

  • Thread starter Thread starter Bob Smith
  • Start date Start date
B

Bob Smith

I have run into a problem that appears to be related to multiple profiles
maching the logon I pass in via CDO. I presume this is related to the Show
Dialogue switch on CDO logon.

An example here would be that I have two accounts with similar names. The
alias of account 1 is "testuser" account 2 is "testuser2". When I pass in the
following;

objsession.Logon "","",false,true,true,true,servername,"testuser"
I get back;

The information store could not be opened MAPI_E_LOGON_FAILED

If I pass in
objsession.Logon "","",false,true,true,true,servername,"testuser2"
It works because is has resolved the profile without multiple returns.

How do I tell CDO logon that the alias I am passing in it absolute?
 
That logon looks really strange to me. I assume that you're relying on True
to evaluate to a 0 for ParentWindow, but that's not a good thing to do. It
also looks like the logon you're using has an extra argument being passed.

From http://www.cdolive.com/cdo5.htm here are the usual methods of logging
into a CDO Session. If you have an existing profile you'd use the second
formulation, if you want to create a dynamic profile for the logon you'd use
the third formulation.

' Logon using an existing MAPI session
objSession.Logon "", "", False, False, 0

' Or, logon using an existing MAPI profile with a new session
objSession.Logon "<Profile Name>", "", False, True, 0

' Or, logon using an new MAPI session with a dynamically created profile
strProfileInfo = "<Your Servername>" & vbLf & "<Your Mailbox>"
objSession.Logon "", "", False, True, 0, False, strProfileInfo
 
Thanks for the information. I changed my logon information too;

strProfileInfo = "<Your Servername>" & vbLf & "<Your Mailbox>"
objSession.Logon "", "", False, True, 0, False, strProfileInfo

I still have the same problem. I am hitting entire exchange servers passing
in the Alias as the "<Your Mailbox>" field. In every case where multiple
results are returned as in my testuser example I get the error.

-2147221231 The information store could not be opened. [MAPI 1.0 -
[MAPI_E_LOGON_FAILED(80040111)]]

It's not permissions I know for sure as I can connect to this using my
logged on account with outlook. The only difference is that multiple
selections popup when creating the profile.
 
Where is this code running? Is it running when Outlook is also running?

Is "testuser" the name of the mailbox or the Exchange alias or what? Same
for "testuser2".
 
It's a VBscript calling CDO 1.2. I got this working now by passing in the
users Legacy Exchange DN. I do however run into a slight problem after some
time where I receieve an error there is not enouogh memory. I checked and the
script is only using about 20MB and this server has a lot of memory. What I
do see though is 1000's of Auto Created MAPI sessions are not being cleaned
up. I have set objSession.Logoff and objSession = Nothing, but it doesn't
seem to clean up the mapi sessions in the registry.

Ken Slovak - said:
Where is this code running? Is it running when Outlook is also running?

Is "testuser" the name of the mailbox or the Exchange alias or what? Same
for "testuser2".




Bob Smith said:
Thanks for the information. I changed my logon information too;

strProfileInfo = "<Your Servername>" & vbLf & "<Your Mailbox>"
objSession.Logon "", "", False, True, 0, False, strProfileInfo

I still have the same problem. I am hitting entire exchange servers
passing
in the Alias as the "<Your Mailbox>" field. In every case where multiple
results are returned as in my testuser example I get the error.

-2147221231 The information store could not be opened. [MAPI 1.0 -
[MAPI_E_LOGON_FAILED(80040111)]]

It's not permissions I know for sure as I can connect to this using my
logged on account with outlook. The only difference is that multiple
selections popup when creating the profile.
 
Where and how do you see "1000's of Auto Created MAPI sessions"?
What version of MAPI are you using? The standalone (Exchange) or the one
that comes with Outlook?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
Bob Smith said:
It's a VBscript calling CDO 1.2. I got this working now by passing in the
users Legacy Exchange DN. I do however run into a slight problem after
some
time where I receieve an error there is not enouogh memory. I checked and
the
script is only using about 20MB and this server has a lot of memory. What
I
do see though is 1000's of Auto Created MAPI sessions are not being
cleaned
up. I have set objSession.Logoff and objSession = Nothing, but it doesn't
seem to clean up the mapi sessions in the registry.

Ken Slovak - said:
Where is this code running? Is it running when Outlook is also running?

Is "testuser" the name of the mailbox or the Exchange alias or what? Same
for "testuser2".




Bob Smith said:
Thanks for the information. I changed my logon information too;

strProfileInfo = "<Your Servername>" & vbLf & "<Your Mailbox>"
objSession.Logon "", "", False, True, 0, False, strProfileInfo

I still have the same problem. I am hitting entire exchange servers
passing
in the Alias as the "<Your Mailbox>" field. In every case where
multiple
results are returned as in my testuser example I get the error.

-2147221231 The information store could not be opened. [MAPI 1.0 -
[MAPI_E_LOGON_FAILED(80040111)]]

It's not permissions I know for sure as I can connect to this using my
logged on account with outlook. The only difference is that multiple
selections popup when creating the profile.
 
That's a problem when you use dynamic logons with CDO, they each create a
new profile entry in the registry. You can write additional code to delete
any profile created that way from the registry when you are finished with
the profile, or if there are existing profiles on the computer that can be
used then use the profile names in the logon call instead of using dynamic
profiles.

It's been many years since I wrote any production CDO code, I moved over to
Redemption coding instead a long time ago. But I vaguely recall that using
client side CDO with dynamic logons creates memory leaks. I could be
mistaken about that however.
 
Ken Slovak - said:
But I vaguely
recall that using client side CDO with dynamic logons creates memory
leaks. I could be mistaken about that however.

_Any_ MAPI logon/logoff cycle generates a memory leak, CDO or not (with
older Exchange or any Outlook version of MAPI)

http://blogs.msdn.com/stephen_griffin/archive/2006/11/03/the-intentional-
memory-leak.aspx

The profile-registry-stuff leak is a separate issue with dynamic
profiles.

-- dan
 
Back
Top