CDO 1.21 and Outlook

M

Mike Lowery

I've got some code that creates a MAPI.Session object and then logs on to the Exchange mail server:

Dim oSession As MAPI.Session
Set oSession = New MAPI.Session
oSession.Logon ProfileName:="MS Exchange Settings", NewSession:=False

This is being done within Outlook using VBA. It works, but the problem is that the .Logon method takes about a half minute to
execute. Since I'm already logged in to Outlook using this profile, is there any way to attach the session to the existing session
instead of creating a new one? The NewSession:=False sounds like it does this, but the 30 second delay tells me otherwise (I
think?)

Anyone know how to get rid of this delay?
 
S

Sue Mosher [MVP-Outlook]

oSession.Logon "", "", False, False
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Mike Lowery said:
I've got some code that creates a MAPI.Session object and then logs on to the Exchange mail server:

Dim oSession As MAPI.Session
Set oSession = New MAPI.Session
oSession.Logon ProfileName:="MS Exchange Settings", NewSession:=False

This is being done within Outlook using VBA. It works, but the problem is
that the .Logon method takes about a half minute to
execute. Since I'm already logged in to Outlook using this profile, is
there any way to attach the session to the existing session
instead of creating a new one? The NewSession:=False sounds like it does
this, but the 30 second delay tells me otherwise (I
 
A

Andrew Cushen

Mike-

Have you tried commenting out the logon line? You
shouldn't need it if you're always logged into Outlook
before the code runs.

-Andrew
================================================
-----Original Message-----
I've got some code that creates a MAPI.Session object and
then logs on to the Exchange mail server:
Dim oSession As MAPI.Session
Set oSession = New MAPI.Session
oSession.Logon ProfileName:="MS Exchange Settings", NewSession:=False

This is being done within Outlook using VBA. It works,
but the problem is that the .Logon method takes about a
half minute to
execute. Since I'm already logged in to Outlook using
this profile, is there any way to attach the session to
the existing session
instead of creating a new one? The NewSession:=False
sounds like it does this, but the 30 second delay tells me
otherwise (I
 
M

Mike Lowery

I get this error if that line is commented/removed:

[Collaboration Data Objects - [MAPI_E_NOT_INITIALIZED(80040605)]]
 
S

Sue Mosher [MVP-Outlook]

Then that's apparently the best you're going to get. I don't know why it
would take so long. Latency on the network?
 
M

Mike Lowery

Possibly, or something else server related. But I don't have that delay doing anything else (reading e-mails, etc.) That's why it
seems as though it's logging onto the server again under a new session. Why else would this line take so long to execute if
everything else is fast?
 

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