
Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
Good morning Ken,
Thank you for your response.
Nothing is wrong with [mail.Display], if you take a look at the code snippet
I included in my initial post, I am making use of it. The problem, though, is
that in order to get a reference to a new mailItem, you need to use
[This.Application.CreateItem...], and since I am making the call from within
a winform, [This.Application] would not work. To solve this problem, I am
using [Globals.ThisAddIn.Application], but this call throws an exception and
that is my problem.
So once I successfully create a mailItem, I would definitely call the
[Display ] method on that Item.
Thank you Ken.
> What's wrong with using mail.Display()? Just create the item when your
> button is clicked and call Display() on the item. If you want a handle to
[quoted text clipped - 50 lines]
> >
> > Thank you for your time and effort.
Ken Slovak - [MVP - Outlook] - 12 May 2008 16:06 GMT
What exception are you getting? I call my "global" Outlook.Application
object from lots of places in my code, including from within Windows forms
with no exceptions.

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
> Good morning Ken,
>
[quoted text clipped - 16 lines]
>
> Thank you Ken.
Jason Wang - 16 Jun 2008 15:52 GMT
I got an error "A dialog box is open. Close it and try again."
My code here:
Outlook.Application thisApp = Globals.ThisAddIn.Application;
Outlook.NameSpace ns = thisApp.GetNamespace("MAPI");
Outlook.MAPIFolder appointmentFolder = thisApp.Session.GetDefaultFolder(
Outlook.OlDefaultFolders.olFolderCalendar);
object o =
ns.GetItemFromID("000000009408AECE65C0E84BAB4CE89B19E6944FA4642100",
appointmentFolder.StoreID);
Outlook.AppointmentItem appointmentItem = (Outlook.AppointmentItem)o;
appointmentItem.Display(false); // or true
Jason
Ken Slovak - [MVP - Outlook] - 17 Jun 2008 14:30 GMT
I don't see where that code is creating the appointment item, but what line
triggers the dialog box open message?
Is the thisApp object valid when you get it? Have you looked at it in debug
mode?
If worst came to worst you could always just set your Outlook.Application
object before calling Show on your form from wherever the form is called.
Also, if you have a NameSpace object why use thisApp.Session? Just use ns
instead.

Signature
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm
>I got an error "A dialog box is open. Close it and try again."
>
[quoted text clipped - 13 lines]
>
> Jason