Event fired while opening a selected mail item in Outlook.

  • Thread starter Thread starter ASAR
  • Start date Start date
A

ASAR

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 .
 
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.
 
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.
 
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
 
I told you already to use the first Activate() event for that Inspector to
do what you want.
 
Back
Top