private List<unreademails> GetEmailsFromFolder(string folderName) { List<unreademails> emails = null; object missing = System.Reflection.Missing.Value; try { Outlook.MAPIFolder fldEmails = null; emails = new List<unreademails>(); Outlook._Application outlookObj = new Outlook.Application(); if (folderName == "Default") { fldEmails = (Outlook.MAPIFolder)outlookObj.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); } else { Outlook.MAPIFolder emailFolder = (Outlook.MAPIFolder) outlookObj.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox); foreach (Outlook.MAPIFolder subFolder in emailFolder.Folders) { if (subFolder.Name == folderName) { fldEmails = subFolder; break; } } } foreach (Microsoft.Office.Interop.Outlook._MailItem mailItem in fldEmails.Items) { if (mailItem.UnRead) { UnreadEmails mail = new UnreadEmails(); { mail.SenderName = (mailItem.UnRead == false) ? string.Empty : mailItem.SenderName; mail.SenderAddress = (mailItem.UnRead == false) ? string.Empty : mailItem.SenderEmailAddress; mail.Subject = (mailItem.UnRead == false) ? string.Empty : mailItem.Subject; mail.BodyContent = MessageBox.Show(mailItem.Body); mail.Attachment = "View Attachments"; emails.Add(mail); } } } </unreademails></unreademails></unreademails>
RunHelloWorld
MessageBox.Show()
mail.BodyContent
DialogResult
MessageBox
DataGridView
CellClick
CellMouseClick
ColumnIndex
RowIndex
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)