![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I have an interesting issue with Open mail item's event.
I have a MailItem wrapper class, which exposes Opening event like this; public class MailDocument { private Outlook.MailItem mailItem; private static Dictionarystring, MailDocument documents = new Dictionarystring, MailDocument(); public event ActionMailDocument, CancelEventArgs Opening; public MailDocument(Outlook.MailItem item) { this.mailItem = item; ((Outlook.ItemEvents_10_Event)mailItem).Open += new Outlook.ItemEvents_10_OpenEventHandler(onOpen); documents.Add(item.EntryID, this); } private void onOpen(ref bool cancel) { CancelEventArgs args = new CancelEventArgs(cancel); Opening(this, args); cancel = args.Cancel; } public static MailDocument Get(Outlook.MailItem mailItem) { MailDocument mailDocument; documents.TryGetValue(mailItem.EntryID, out mailDocument); return mailDocument; } } } NewInspector event handler is like this: Outlook.MailItem current = inspector.CurrentItem as Outlook.MailItem; MailDocument mailDocument = MailDocument.Get(current); mailDocument.Opening += new ActionMailDocument, CancelEventArgs(OnOpening); Opening event is never invoked. But, if I change these lines of code, event handler is invoked every time. Outlook.MailItem current = inspector.CurrentItem as Outlook.MailItem; MailDocument mailDocument = new MailDocument(current); mailDocument.Opening += new ActionMailDocument, CancelEventArgs(OnOpening); Do you have an idea why this is happening? I noticed that in the default Microsoft example is the same. Also, if I cancel a mail item default inspector, it does shows for a part of second, so that a display is flickering a little bit. -- Nenad Dobrilovic |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Event fired while opening a selected mail item in Outlook. | ASAR | Add-ins for Outlook | 5 | May 19th 08 09:40 PM |
event raised on selecting a mail item in ms outlook | ASAR | Add-ins for Outlook | 1 | May 19th 08 12:57 PM |
New Mail Item Event | Neetu | Add-ins for Outlook | 6 | April 4th 08 02:11 PM |
catch the mail item on_focus event | john | Outlook and VBA | 1 | September 28th 06 12:33 PM |
Item Open event does not occurs every time | sfradel | Add-ins for Outlook | 1 | September 2nd 06 04:33 PM |