The filtering rules of outlook are not very reliable. Adding an email can be moved by Filtering Rule A to the folder A, or be moved by Filtering Rule B to B. According to common sense, if a executes the mail first, the mail should be in directory A, but not in directory B. But outlook is too depressing. both A and B will send this email.
There are a lot of emails from the company, and there are often some emails sent from machines, which are very depressing, and many emails are sent to the contact group rather than to me. So I want to get some filtering rules to divide them into different folders. However, because the outlook filter rules have bugs and are not powerful enough, you cannot write perfect filters.
I think of vsto, and I went home and studied it myself. I found that it would be easier to use C # To complete this job. I tried it and found it really useful.
Create a vsto for outlookProgram,
Private void thisaddin_startup (Object sender, system. eventargs E)
{
Application. newmailex + = new outlook. applicationevents_11_newmailexeventhandler (application_newmailex );
}
Add an event to the Startup Program to send new emails.
Void application_newmailex (string entryidcollection)
{
Foreach (string ID in entryidcollection. Split (','))
{
VaR item = application. session. getitemfromid (ID) as outlook. mailitem;
}
}
For new emails, you can simply proceed.