Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / May 2008

Tip: Looking for answers? Try searching our database.

Event fired while opening a selected mail item in Outlook.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ASAR - 08 May 2008 08:55 GMT
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 .
Ken Slovak - [MVP - Outlook] - 08 May 2008 14:26 GMT
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.

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 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 .
ASAR - 16 May 2008 10:18 GMT
What if the mailitem is not new  i.e it is read and presentin outlook
explorer window.

> 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
[quoted text clipped - 8 lines]
> > fired
> > just  before opening a mailitem .
Ken Slovak - [MVP - Outlook] - 16 May 2008 14:28 GMT
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.

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

> What if the mailitem is not new  i.e it is read and presentin outlook
> explorer window.
ASAR - 19 May 2008 07:41 GMT
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



> 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.
>
> > What if the mailitem is not new  i.e it is read and presentin outlook
> > explorer window.
Ken Slovak - [MVP - Outlook] - 19 May 2008 21:40 GMT
I told you already to use the first Activate() event for that Inspector to
do what you want.

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 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
[quoted text clipped - 10 lines]
>        test.Save()
>        End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.