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

Event fired while opening a selected mail item in Outlook.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 8th 08, 08:55 AM posted to microsoft.public.outlook.program_addins
ASAR
external usenet poster
 
Posts: 4
Default Event fired while opening a selected mail item in Outlook.

I am using shared addins in VB.net 2005 for developin Outlook addin. How can
I write my code for changing mailitem body and attachment on the event fired
just before opening a mailitem .
Ads
  #2  
Old May 8th 08, 02:26 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Event fired while opening a selected mail item in Outlook.

The NewInspector event of the Inspectors collection fires when a new item is
opened. However, you cannot rely on the item in the Inspector being fully
populated in that event. If you only want to handle mail items you will need
to check the Inspector.CurrentItem.Class property (using reflection) in that
event and then use the first Inspector.Activate event for that Inspector to
get at the mail item properties such as Body or the Attachments collection.

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


"ASAR" wrote in message
...
I am using shared addins in VB.net 2005 for developin Outlook addin. How
can
I write my code for changing mailitem body and attachment on the event
fired
just before opening a mailitem .


  #3  
Old May 16th 08, 10:18 AM posted to microsoft.public.outlook.program_addins
ASAR
external usenet poster
 
Posts: 4
Default Event fired while opening a selected mail item in Outlook.

What if the mailitem is not new i.e it is read and presentin outlook
explorer window.

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

The NewInspector event of the Inspectors collection fires when a new item is
opened. However, you cannot rely on the item in the Inspector being fully
populated in that event. If you only want to handle mail items you will need
to check the Inspector.CurrentItem.Class property (using reflection) in that
event and then use the first Inspector.Activate event for that Inspector to
get at the mail item properties such as Body or the Attachments collection.

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


"ASAR" wrote in message
...
I am using shared addins in VB.net 2005 for developin Outlook addin. How
can
I write my code for changing mailitem body and attachment on the event
fired
just before opening a mailitem .



  #4  
Old May 16th 08, 02:28 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Event fired while opening a selected mail item in Outlook.

It doesn't matter if the item is new, a reply, a forward or whatever. If you
open it you get a NewInspector event, since all open Outlook items are
displayed in Inspectors.

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


"ASAR" wrote in message
...
What if the mailitem is not new i.e it is read and presentin outlook
explorer window.


  #5  
Old May 19th 08, 07:41 AM posted to microsoft.public.outlook.program_addins
ASAR
external usenet poster
 
Posts: 4
Default Event fired while opening a selected mail item in Outlook.

I tried it it is working but when ichanged the properties of militem like
subject ,body , attachment on this event and save it It doesnot appear while
mail item is opened. I am using following code


Private Sub tyINS_NewInspector(ByVal Inspector As
Microsoft.Office.Interop.Outlook.Inspector) Handles tyINS.NewInspector
Dim test As Object
test = Inspector.CurrentItem
test.Subject = "NEW SUBJECT"
test.Body = "NEW BODY APPENDED TO MAIL ITEM"

test.Save()
End Sub



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

It doesn't matter if the item is new, a reply, a forward or whatever. If you
open it you get a NewInspector event, since all open Outlook items are
displayed in Inspectors.

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


"ASAR" wrote in message
...
What if the mailitem is not new i.e it is read and presentin outlook
explorer window.



  #6  
Old May 19th 08, 09:40 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Event fired while opening a selected mail item in Outlook.

I told you already to use the first Activate() event for that Inspector to
do what you want.

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


"ASAR" wrote in message
...
I tried it it is working but when ichanged the properties of militem like
subject ,body , attachment on this event and save it It doesnot appear
while
mail item is opened. I am using following code


Private Sub tyINS_NewInspector(ByVal Inspector As
Microsoft.Office.Interop.Outlook.Inspector) Handles tyINS.NewInspector
Dim test As Object
test = Inspector.CurrentItem
test.Subject = "NEW SUBJECT"
test.Body = "NEW BODY APPENDED TO MAIL ITEM"

test.Save()
End Sub


 




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
Event handler when a mail from the inbox is selected Cherry Add-ins for Outlook 1 February 9th 08 01:10 PM
event fired when email address clicked Peter Add-ins for Outlook 1 June 1st 07 07:05 PM
Search of an event fired immediate before Quit-event Peter Ostermann Outlook and VBA 4 April 6th 07 07:46 AM
Explorer' Close event not fired j Add-ins for Outlook 9 April 2nd 07 02:24 PM
What event gets fired when i show/hide my outlook toolbar Gautam Outlook and VBA 1 July 12th 06 02:21 PM


All times are GMT +1. The time now is 03:45 PM.


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.