Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Right now I use this code to retrieve the body of an email from Exchange 2010:

VB
i.Load(New PropertySet(BasePropertySet.IdOnly, ItemSchema.Body))
Dim strEmailBodyLines() As String = Split(i.Body.Text, vbCrLf)


Unfortunately I get a HTML response, but I only want plain text from the body in an array (each line). If I replace ItemSchema.Body with ItemSchema.Textbody I get an error it is supported on Exchange 2013 and higher.

Can someone tell me how to get the plain text body?

What I have tried:

I tried to change basic and extended properties, but I keep getting an error that Textbody is supported on Exchange 2013 and higher.
Posted
Updated 18-Nov-20 21:16pm

1 solution

Simplest way is probably to use something like the HTMLAgility Pack to process the HTML and remove the text from that. If nothing else, that approach should work with any system ...
 
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