Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
outlook.MAPIFolder selectedFolder = m_applicationObject.ActiveExplorer().CurrentFolder;
                        string expMessage = "Your current folder is " + selectedFolder.Name + ".\n";
                        string itemMessage = "Item is unknown.";
                        try
                        {
                            if (m_applicationObject.ActiveExplorer().Selection.Count > 0)
                            {
                                Object selObject = m_applicationObject.ActiveExplorer().Selection[1];
                                if (selObject is outlook.MailItem)
                                {
                                    outlook.MailItem mailItem = (selObject as outlook.MailItem);
                                    itemMessage = " The subject is " + mailItem.Subject + ". \n";
                                    itemMessage += " The Email is " + getSenderEmailAddress(mailItem)  + ".\n";
                                    itemMessage += " The name is " + mailItem.SenderName + ".\n";
                                    itemMessage += " The Desc is " + mailItem.Body  + ".\n"; 
                                    //body consist of too many emails and its replies. is there any way i can extract latest email content from mailitem.Body
                                    //  mailItem.Display(false);
                                }
                            }
                     }


What I have tried:

In above code i am extracting email details from outlook addin body consist of too many emails and its replies. is there any way i can extract latest email content from mailitem.Body
Posted
Updated 8-Jun-20 20:56pm

1 solution

You really need a parser that understands the mime spec to parse the body into the sections - I'd start looking at Working with messages[^] for instance
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900