private OutlookMailInfo MailInfoFromMailItem(MailItem mail)
        {
            OutlookMailInfo info = new OutlookMailInfo();
            info.Subject = mail.Subject;
            info.Body = mail.Body;
            info.CC = mail.CC;
            info.SenderEmail = mail.SenderEmailAddress;
            info.SentDate = mail.SentOn;
            info.To = mail.To;
            info.EntryID = mail.EntryID;
            info.SenderName = mail.SenderName;

            if (mail.Attachments != null && mail.Attachments.Count > 0)
                info.HasAttachments = true;

            info.UnRead = mail.UnRead;
            return info;
        }
 public List<OutlookMailInfo> GetMailList()
 {
     Microsoft.Office.Interop.Outlook.MailItem item = null;
     List<OutlookMailInfo> listData = new List<OutlookMailInfo>();
     if (m_DicomFolder != null)
     {
         Console.WriteLine("Inbox counts: " + m_inboxFolder.Items.Count.ToString());
         for (int i = 1; i <= m_DicomFolder.Items.Count; i++)
         {
             OutlookMailInfo mail = new OutlookMailInfo();
             item = (Microsoft.Office.Interop.Outlook.MailItem)m_DicomFolder.Items[i];
             mail.SenderName = i.ToString();
             mail.Subject = item.Subject;
             mail.SentDate = item.SentOn;
             listData.Add(mail);
             //Console.WriteLine("Categories: {0}", item.Categories);
             //Console.WriteLine("Body: {0}", item.Body);
             //Console.WriteLine("HTMLBody: {0}", item.HTMLBody);
         }
     }
     else
     {
         Console.WriteLine("Inbox counts: " + m_inboxFolder.Items.Count.ToString());
         for (int i = 1; i <= m_inboxFolder.Items.Count; i++)
         {
             OutlookMailInfo mail = new OutlookMailInfo();
             item = (Microsoft.Office.Interop.Outlook.MailItem)m_inboxFolder.Items[i];
             mail.SenderName = i.ToString();
             mail.Subject = item.Subject;
             mail.SentDate = item.SentOn;
             listData.Add(mail);
             //Console.WriteLine("Categories: {0}", item.Categories);
             //Console.WriteLine("Body: {0}", item.Body);
             //Console.WriteLine("HTMLBody: {0}", item.HTMLBody);
         }
     }
     return listData;
 }