Is there any way to get all mail from an specific Folder into my Application?
This usually happens because of one of the following reasons: You have Focused Inbox enabled. You have a filter applied to your view. You are not allowed to see private items in a shared mailbox.
Open your Gmail app. Tap the section that says Search in emails at the top of the screen. Type in “is:unread in:inbox” and press Search. All your unread emails will appear on the display.
Check this link. Introduction to Outlook Programming will explain things more clearly.
You could loop through the mailitems. Sample code
using System.Runtime.InteropServices;
using OutLook = Microsoft.Office.Interop.Outlook;
using Office = Microsoft.Office.Core;
OutLook.Application oApp;
OutLook._NameSpace oNS;
OutLook.MAPIFolder oFolder;
OutLook._Explorer oExp;
oApp = new OutLook.Application();
oNS = (OutLook._NameSpace)oApp.GetNamespace("MAPI");
oFolder = oNS.GetDefaultFolder(OutLook.OlDefaultFolders.olFolderInbox);
oExp = oFolder.GetExplorer(false);
oNS.Logon(Missing.Value, Missing.Value, false, true);
OutLook.Items items = oFolder.Items;
foreach (OutLook.MailItem mail in items)
{
if (mail.UnRead == true)
{
}
}
Edit: Reference other folders
oFolder.Folders["Foldername"]
OutLook Code
Common Outlook tasks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With