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;
//checking for unread mails
foreach (Microsoft.Office.Interop.Outlook .MailItem mail in items)
{
if (mail.UnRead == true)
{
//Paste the code for already opened mails
if (mail.SenderName.Trim() == "crozzX")
{
//Paste the code for a particular User
}
}
else
{
//Paste the code for already opened mails
}
}
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;
//checking for unread mails
foreach (Microsoft.Office.Interop.Outlook .MailItem mail in items)
{
if (mail.UnRead == true)
{
//Paste the code for already opened mails
if (mail.SenderName.Trim() == "crozzX")
{
//Paste the code for a particular User
}
}
else
{
//Paste the code for already opened mails
}
}
Comments
Post a Comment