private void GetUnreadEmails4() { OutLook.Application myApp; myApp =new OutLook.Application(); NameSpace mapiNameSpace = myApp.GetNamespace("MAPI"); MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); Items oItems = myInbox.Items.Restrict("[UnRead] = true"); //Items oItems = myInbox.Items.Restrict("[UnRead] = true"); MessageBox.Show(oItems.Count.ToString()); foreach (dynamic item in oItems) { try { var oMsg = (MailItem)item; listBox1.Items.Add(oMsg.Subject.ToString()); } catch (System.Exception) { } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)