Hi,
I'm trying to save emails stored in dynamics to my drive. I'm able to extract the attachments by doing a WriteBinaryContent but now I would like to extract the content of the email. to extract the attachment I'm using the "activitymimeattachment" entity. To extract the content of the email I'm looking at the"Email" entity but it does not seem to have a body field or content field. Am I looking at the wrong entity?
Thank you.
*This post is locked for comments
Thank you so much Bharat, it really helped.
Hi GP (and Aric),
If you download the Kingsway Productivity Pack:
[View:https://www.kingswaysoft.com/products/ssis-productivity-pack:750:50]
There is a Premium Derived Column component. Within that there is a function called StripTagsFromHtml:
Using that you should see something like this:
Hope that helps.
Bharat
There is no easy way to strip the Text from the HTML.
You have two options basically:
1. In SSIS add a Script Component that passes the HTML Text and returns the Plain Text. You can use Regular Expressions for that. See below link:
stackoverflow.com/.../how-can-i-strip-html-tags-from-a-string-in-asp-net
2. In you have a SQL Server, you can call a procedure or function to strip the HTML tags. See the UDF (First answer) in the link below:
stackoverflow.com/.../best-way-to-strip-html-tags-from-a-string-in-sql-server
Hope one of these solutions will work for you.
Hi Bharat,
Yes I'm now able to see the text but I also see some html code with it. Is there some functions that can remove the HTML parts? I'm looking at regular expression to see if that can be done but at the same time I would expect the email to be saved as an email so I might need the html code after all?!
Hi GP
Are you seeing <Long Text> when you put the data view in the SSIS Package? If so, its due to the field being ntext.
If you put in a derived column and convert the description field to (DT_WSTR,4000)[description] and put the data viewer in after that, you should see the text
Bharat
Thanks for your reply Bharat. I ran the fetch and the Subject displays but not the description. The description just say <Long Text>. Those emails were synched from Outlook via the plugin. Do you think that is the reason why the body is not showing up?
Hi GP,
The body of the email is stored in the description field. Try this fetch, it will retrieve the Subject and Body:
<fetch top="50" >
<entity name="email" >
<attribute name="description" />
<attribute name="subject" />
</entity>
</fetch>
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156