A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

New Mail Item Event



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 2nd 08, 12:27 PM posted to microsoft.public.outlook.program_addins
Neetu
external usenet poster
 
Posts: 19
Default New Mail Item Event

I am creating a outlook add-in .on clicking on any custom folder created by
our add-in, we are opening windows forms.
according to requirement , if some exception occours, we are providing a
link button on errror form ( a window form with link button). on clicking on
link we have to send mail from outlook.
I am opening a mail item inside outlook programmatically. I m doing this like.

MailItem lobjNewMailitem =
(MailItem)Application.CreateItem(OlItemType.olMail Item);
Microsoft.Office.Interop.Outlook.Application lobjApplication =
this.Application;
Microsoft.Office.Interop.Outlook.Inspector lobjInspector;
lobjInspector = lobjApplication.Inspectors.Add(lobjNewMailitem);
lobjNewMailitem = (MailItem)lobjInspector.CurrentItem;

lobjInspector.Activate();
lobjInspector.Display(lobjNewMailitem);

above code work fine if in case no other custom folder is opened inside
outlook.
eg - when user first time open outlook and if exception occurs.

however soppose , if already other custom winform is opened like "Filter
form" ( one of the windows form )
this code doesn't work..

it says

"A dialog Box is open. close it and try again"

Inside code before displaying new mail item , i m explicitly closing all
possible forms like in our case we have 2 forms. so i m checking for them and
closing all.
still I m getting this exception.
I am using c#, and VSTO for outlook 2007

any suggesstion would be g8 help.!!
  #2  
Old April 2nd 08, 04:21 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default New Mail Item Event

If you have a modal form open in your addin you can't open a new item until
that form is closed or hidden. It's the same in any language you use (C#,
VB.NET, VB6, C++, etc.).

You can either hide or close your form when you want to open an Outlook
item.

--
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


"Neetu" wrote in message
...
I am creating a outlook add-in .on clicking on any custom folder created by
our add-in, we are opening windows forms.
according to requirement , if some exception occours, we are providing a
link button on errror form ( a window form with link button). on clicking
on
link we have to send mail from outlook.
I am opening a mail item inside outlook programmatically. I m doing this
like.

MailItem lobjNewMailitem =
(MailItem)Application.CreateItem(OlItemType.olMail Item);
Microsoft.Office.Interop.Outlook.Application lobjApplication =
this.Application;
Microsoft.Office.Interop.Outlook.Inspector lobjInspector;
lobjInspector = lobjApplication.Inspectors.Add(lobjNewMailitem);
lobjNewMailitem = (MailItem)lobjInspector.CurrentItem;

lobjInspector.Activate();
lobjInspector.Display(lobjNewMailitem);

above code work fine if in case no other custom folder is opened inside
outlook.
eg - when user first time open outlook and if exception occurs.

however soppose , if already other custom winform is opened like "Filter
form" ( one of the windows form )
this code doesn't work..

it says

"A dialog Box is open. close it and try again"

Inside code before displaying new mail item , i m explicitly closing all
possible forms like in our case we have 2 forms. so i m checking for them
and
closing all.
still I m getting this exception.
I am using c#, and VSTO for outlook 2007

any suggesstion would be g8 help.!!


  #3  
Old April 3rd 08, 07:04 AM posted to microsoft.public.outlook.program_addins
Neetu
external usenet poster
 
Posts: 19
Default New Mail Item Event

Yes Ken. That Y before opening ne main item, i m explicity closing all
possible forms. we have total 2 forms inside our project. still i m getting
this error message.
Is there any way to find any open modal form inside outlook?



"Ken Slovak - [MVP - Outlook]" wrote:

If you have a modal form open in your addin you can't open a new item until
that form is closed or hidden. It's the same in any language you use (C#,
VB.NET, VB6, C++, etc.).

You can either hide or close your form when you want to open an Outlook
item.

--
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


"Neetu" wrote in message
...
I am creating a outlook add-in .on clicking on any custom folder created by
our add-in, we are opening windows forms.
according to requirement , if some exception occours, we are providing a
link button on errror form ( a window form with link button). on clicking
on
link we have to send mail from outlook.
I am opening a mail item inside outlook programmatically. I m doing this
like.

MailItem lobjNewMailitem =
(MailItem)Application.CreateItem(OlItemType.olMail Item);
Microsoft.Office.Interop.Outlook.Application lobjApplication =
this.Application;
Microsoft.Office.Interop.Outlook.Inspector lobjInspector;
lobjInspector = lobjApplication.Inspectors.Add(lobjNewMailitem);
lobjNewMailitem = (MailItem)lobjInspector.CurrentItem;

lobjInspector.Activate();
lobjInspector.Display(lobjNewMailitem);

above code work fine if in case no other custom folder is opened inside
outlook.
eg - when user first time open outlook and if exception occurs.

however soppose , if already other custom winform is opened like "Filter
form" ( one of the windows form )
this code doesn't work..

it says

"A dialog Box is open. close it and try again"

Inside code before displaying new mail item , i m explicitly closing all
possible forms like in our case we have 2 forms. so i m checking for them
and
closing all.
still I m getting this exception.
I am using c#, and VSTO for outlook 2007

any suggesstion would be g8 help.!!



  #4  
Old April 3rd 08, 03:19 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default New Mail Item Event

Hmm, see if it's any better if you don't use an Inspector at all when you
create the mail item, something like this:

MailItem lobjNewMailitem =
(MailItem)Application.CreateItem(OlItemType.olMail Item);

lobjNewMailItem.Display(false);

If Outlook is actually displaying an error or warning message that could
also be the problem. In that case about all you can do is to make sure the
error doesn't occur with lots of checking to prevent the error in the first
place.

--
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


"Neetu" wrote in message
...
Yes Ken. That Y before opening ne main item, i m explicity closing all
possible forms. we have total 2 forms inside our project. still i m
getting
this error message.
Is there any way to find any open modal form inside outlook?


  #5  
Old April 4th 08, 01:44 PM posted to microsoft.public.outlook.program_addins
Neetu
external usenet poster
 
Posts: 19
Default New Mail Item Event

Hi Ken,

I found some other alternative . directly sending mail .
lobjNewMailItem.send();

Ken, is there any way to find where outlook is in offline or online..
so that if I fire this statement i can give appropriate message and save the
message in his/her mail box.


"Ken Slovak - [MVP - Outlook]" wrote:

Hmm, see if it's any better if you don't use an Inspector at all when you
create the mail item, something like this:

MailItem lobjNewMailitem =
(MailItem)Application.CreateItem(OlItemType.olMail Item);

lobjNewMailItem.Display(false);

If Outlook is actually displaying an error or warning message that could
also be the problem. In that case about all you can do is to make sure the
error doesn't occur with lots of checking to prevent the error in the first
place.

--
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


"Neetu" wrote in message
...
Yes Ken. That Y before opening ne main item, i m explicity closing all
possible forms. we have total 2 forms inside our project. still i m
getting
this error message.
Is there any way to find any open modal form inside outlook?



  #6  
Old April 4th 08, 02:55 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default New Mail Item Event

Sure. In Outlook 2007 you have a couple of things you can check:

NameSpace.ExchangeConnectionMode
NameSpace.Offline

Review the Object Browser help on those properties.

--
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


"Neetu" wrote in message
news
Hi Ken,

I found some other alternative . directly sending mail .
lobjNewMailItem.send();

Ken, is there any way to find where outlook is in offline or online..
so that if I fire this statement i can give appropriate message and save
the
message in his/her mail box.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Before delete mail item Event Handler RAMS Outlook - Using Forms 3 March 3rd 08 02:38 PM
NULL event item ? Mark Beiley Add-ins for Outlook 0 September 19th 07 12:46 AM
Item Unload Event Doesn't Fire Tim Pulley Add-ins for Outlook 3 May 16th 07 05:42 PM
catch the mail item on_focus event john Outlook and VBA 1 September 28th 06 01:33 PM
Item Move event AtulSureka Outlook and VBA 1 February 24th 06 02:33 PM


All times are GMT +1. The time now is 07:07 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.