In my OLK 2016 addin i have defined
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.NewMail += new Microsoft.Office.Interop.Outlook.ApplicationEvents_11_NewMailEventHandler(ThisApplication_NewMail);
}
In ThisApplication_NewMail, i have some code that does some categorization with that mail when it arrives, depending on sender, and such things. This works just fine. However, I also have defined in OLK some "move email" type rules (the mail is moved in folder nested in the Inbox, not outside the mailbox), which, on occasion, do apply to the mails that should be categorized by my addin. Breakpointing on the method's entry does not happen, which indicates the manually defined rules process the mail before my code (for lack of a better informed technical explanation).
So I am looking for a way in which I can either write the code differently in order to process with my code before the manual defined rules, or define a priority between the two, or something in those lines.
One way i could think on working around it is to simply enumerate all the folders in the inbox and run my IFs there, however, this might end up with a performance penalty since there are a lot of unread mails to be processed.
Anyone has a better idea on how to achieve my scenario? Pointers are sufficient, not asking for the code necessarily.