Opening Outlook using MAPI locks main interface

N

nagar

I'm opening Outlook from a C# appplication using MAPI. Outlook
correctly created a new email window but the main application window
is disabled.
I noticed that the same thing happens when composing a new email with
attachment using the context menu (send attachment to email
recipient).

Is there a way to prevent the main window to disable itself (the same
way it happens when you compose a new email directly from inside
outlook?)
Thanks,
Andrea
 
D

Dmitry Streblechenko

Whatr is the relevant snppet of your code hat locks your app?
Are you calling IMAPISession.ShowForm() To display a message modelessly, use
IMAPIForm.DoVerb(EXCHIVERB_OPEN, ...).
Why are you opening a form using MAPI? Outlook Object Model would be a lot
easier.

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

nagar

Thanks for the reply.
I'm using MAPI because I need to connect to any email application.
I'm currently calling
int error = MAPISendMail(IntPtr.Zero, IntPtr.Zero, message,
MAPI_DIALOG, 0);

What call should I make? I don't want to send a message but just open
a new precompiled email message.

Do you have a snippet of code to do that?
Do you think it's better to use MAPI for all the applications and so
something different for Outlook?

Thanks.
Andrea
 
D

Dmitry Streblechenko

OK, that is Simple MAPI, I meant Extended MAPI (which only Outlook
supports).
There is nothing you can do in Simple MAPI...
You can test that the user has Outlook installed and use OOM instead:

set App = CreateObject("Outlook.Application")
set Msg = App.CreateItem(0)
Msg.Subject = "test subject"
Msg.Display

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

nagar

Thanks. I'll look into that.
Andrea

OK, that is Simple MAPI, I meant Extended MAPI (which only Outlook
supports).
There is nothing you can do in Simple MAPI...
You can test that the user has Outlook installed and use OOM instead:

set App = CreateObject("Outlook.Application")
set Msg = App.CreateItem(0)
Msg.Subject = "test subject"
Msg.Display

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

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