Use C # To implement advanced outlook Filter

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.