Outlook Namespace logoff issue

  • Thread starter Thread starter Bingo
  • Start date Start date
B

Bingo

My VB apps use the following code to log on and off:

m_oNsp.Logon "", "", True, True

m_oNsp.Logoff
set m_oNsp = Nothing

Both App1 and App2 are running. I then close App2. When
I close App1, the Logoff method actually loads the
Outlook profile window. If I take out the Logoff and
only set to Nothing, I do not have the problem. But the
Outlook is left in the memory.

Is it possible to keep the Outlook session if another app
is using it? Thanks.
 
The NameSpace Logon and Logoff methods are generally pretty useless in most
circumstances. If you release all your objects by setting them to Nothing in
App1 (if using .NET languages then call the garbage collector explicitly)
then if App2 has an Outlook reference it will still have it after App1
terminates. When App2 releases all it's objects Outlook should close if
nothing else has an Outlook reference outstanding.

To force Outlook to close you can use Outlook.Application.Quit, but unless
all your Outlook objects are released Outlook would still remain in memory.
 
It seems Logoff terminates MapiSp32.Exe. Here's what I
found.

Once I log on from both App1 and App2, both Outlook.Exe
and MapiSp32.Exe are loaded in the memory. If I log off
from App1 when closing App1, Outlook.Exe is still loaded
but MapiSp32.Exe is gone. If I call any Outlook methods
from App2, the Outlook profile selection window pops up.
If I do not log off from App1 when closing App1, both
Outlook.Exe and MapiSp32.Exe are still loaded. No errors
when calling Outlook methods from App2.


-----Original Message-----
The NameSpace Logon and Logoff methods are generally pretty useless in most
circumstances. If you release all your objects by setting them to Nothing in
App1 (if using .NET languages then call the garbage collector explicitly)
then if App2 has an Outlook reference it will still have it after App1
terminates. When App2 releases all it's objects Outlook should close if
nothing else has an Outlook reference outstanding.

To force Outlook to close you can use
Outlook.Application.Quit, but unless
 
Is there a question there? As I said, just don't use Logoff (or Logon) and
if everything else if coded correctly both of the apps should run OK and
terminate OK.
 
Back
Top