I noticed that most samples use the Outlook collections, which are known for their not so optimum performance when they get bigger and you need to filter out a few items (basically you have to iterate through all of the items).
In Outlook 2007 there's a new class; Outlook.Table (and Row) which allows you to get to the items in a folder and apply an SQL-like filter. This is a very clean and fast way of accessing your items. Combined with LINQ here's some code I came up with, I'm looking to further optimise that using types etc. but wanted to share this simple example anyway.
static void TableTestUsingLinqAndExtensionMethod()
Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
Outlook.MAPIFolder folder = outlook.GetNamespace("MAPI").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
string filter = @"@SQL=""urn:schemas:httpmail:subject"" like '%devcon%'";
Outlook.Table table = folder.GetTable(filter, null);
var mailitems = from mitem in table.mailitem() select mitem;
foreach (var item in mailitems)
public static class OutlookTableExtension
public static IEnumerable
if (source == null)
throw new ArgumentNullException("source");
yield return source.GetNextRow();
Try it out on some large collections and you'll see it is surprisingly fast!