21 March 2014

Get Count of Unread mail from Outlook Express in C#.Net

Get Count of Unread mail from Outlook Express in C#.Net

 using Microsoft.Office.Interop.Outlook;  
public static int CountOfUnreadMails()
{
Application OutlookApp = new Application();
NameSpace myMail = OutlookApp.GetNamespace("MAPI");
int unread = myMail.GetDefaultFolder(OlDefaultFolders.olFolderInbox).UnReadItemCount;
return unread;
}

No comments: