I use the code below to check unread mail from Outlook and everything works fine for the default inbox
Microsoft.Office.Interop.Outlook.Application oApp; Microsoft.Office.Interop.Outlook._NameSpace oNS; Microsoft.Office.Interop.Outlook.MAPIFolder oFolder; Microsoft.Office.Interop.Outlook._Explorer oExp; oApp = new Microsoft.Office.Interop.Outlook.Application(); oNS = (Microsoft.Office.Interop.Outlook._NameSpace)oApp.GetNamespace("MAPI"); oFolder = oNS.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox); oExp = oFolder.GetExplorer(false); oNS.Logon(Missing.Value, Missing.Value, false, true); Microsoft.Office.Interop.Outlook.Items items = oFolder.Items; foreach (Object mail in items) { if ((mail as Microsoft.Office.Interop.Outlook.MailItem) != null && (mail as Microsoft.Office.Interop.Outlook.MailItem).UnRead == true) { string sasd= (mail as OutLook.MailItem).Subject.ToString(); } }
But I want to check another folder [which I created [Name = "Inbox_Personal"]]. How can i do this?
Change 1
Any suggestion or link to the tutorial will be appreciated.
Chris source share