using System.Collections.Generic;
using Outlook = Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Interop.Outlook;
static void Main(string[] args)
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, false, true);
Microsoft.Office.Interop.Outlook.MAPIFolder folder = oNS.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
List<MailItem> msgs = folder.Items.OfType<MailItem>().ToList();
Console.WriteLine(">> FILTR <<<\n\nNaciśnij ENTER, żeby przeszukać skrzynkę...");
ConsoleKey userKey = Console.ReadKey(true).Key;
if (userKey == ConsoleKey.Enter)
foreach (MailItem msg in msgs)
string msgText = msg.Body;
msgText = string.Join("", msgText.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
if (msgText.Contains("Czyzłożonoreklamację?NIE") && msg.Subject.Contains("test"))
msg.Move(folder.Folders["TEST"]);
Console.WriteLine("\nZakończono czyszczenie skrzynki!");
Console.WriteLine("\nNaciśnij ENTER!");