View Single Post
  #7  
Old September 3rd 09, 07:32 AM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default How to catch Message Move Event.

plug
You can do that using Redemption: it exposes RDOStore.OnMessageCreated /
OnMessageDeleted / etc events on the store level
See http://www.dimastr.com/redemption/rdo/rdostore.htm
plug

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Ashutosh Jogdande" wrote in message
...
Hi Ken,

Thanks for quick reply.

By adding ItemRemove event handler on outlookExplorer.CurrentFolder I am
able to catch the event.

But How to add event handler for all folders when addin gets loaded, as we
want to catch events for the mails which are getting archived or Moved
using Email-Rules.

I have tried by adding event handler to all the folders on addin startup,
but it didn't work.

Is there any way to trap this event at Explorer level?

Here is the code :
IEnumerator enumrator =
_outlookApplication.Session.Folders.GetEnumerator( );
while (enumrator.MoveNext())
{
Outlook.Folder folder = (Outlook.Folder)enumrator.Current;
if (folder != null)
{
AddEventHandlers(folder);
}
}

where AddEventHandlers recursively adding event hadler to each folder.

Thanks,
Ashutosh



"Ken Slovak - [MVP - Outlook]" wrote in message
...
That would partially depend on what version of Outlook. For Outlook 2003
and earlier you only would have the Items.ItemAdd() and ItemRemove()
events on the destination and source folders to rely on. In Outlook 2007
you have the Folder.BeforeItemMove() event you could also try.

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


"Ashutosh Jogdande" wrote in message
...
Hi All,

Is there any way to Catch Message Move event through outlook addin,
when message/s are moved by using Email-rules or to Archive folders?

I am able to do this on manual message move by catching ItemRemove on
selected folder.
But while running a rule I am not getting Message Move/Remove event.

Code :
outlookExplorer.CurrentFolder.Items.ItemRemove += new
Microsoft.Office.Interop.Outlook.ItemsEvents_ItemR emoveEventHandler(Items_ItemRemove);


Thanks in advance,
Ashutosh








Ads