Outlook program with multiple profiles

A

Atul Thombre

Hello,

I am writing a program using Outlook Object Model. The program sequentially
connects to two profiles. The first call to Logon() prompts for the
password, but somehow the second call does not prompt me for the password.

I also observed that when the first connection ends (after the call to
NameSpace.Logoff() and Application.Quit()) the Outlook.exe process
disappears from the Task Manager. But, when the Logon() call is made, the
Outlook logs in using the first profile.

I am calling Marshal.ReleaseComObject() for every instance of COM object
created and also have calls for GC.Collect() and
GC.WaitForPendingFinalizers().

Can someone shed some light on this?

Thanks,

Atul.
 
D

Dmitry Streblechenko

How do you know the second Logon uses the first profile?
Do you use any other libraries (e.g. CDO 1.21 or Redemption) besides Outlook
that might keep the first MAPI session alive?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
A

Atul Thombre

Dmitry Streblechenko said:
How do you know the second Logon uses the first profile?

I get the default store, and print its name. It displays the name of the
first mailbox
Do you use any other libraries (e.g. CDO 1.21 or Redemption) besides
Outlook that might keep the first MAPI session alive?

Nope. I am not using any CDO or Redemption calls. But I am using 'Profiles'
for creating profiles... both of them.

In fact, I wrote a test program that has two push buttons and a text box. In
the handlers for the push button, I wrote some code to logon to Exchange
using Outlook Object Model, and then print the name of the default store in
the text box. I used two different profiles in the handlers for the two push
buttons. But the behavior was the same. Here I am not even creating a
profile, I am using profiles already created.

Atul.
 

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