web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Extracting Emails content using Kingswaysoft

(0) ShareShare
ReportReport
Posted on by 365

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

I have the same question (0)
  • Suggested answer
    BharatPremji Profile Picture
    2,485 on at

    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>

  • Pega Profile Picture
    365 on at

    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?

  • BharatPremji Profile Picture
    2,485 on at

    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

  • Pega Profile Picture
    365 on at

    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?!

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Verified answer
    BharatPremji Profile Picture
    2,485 on at

    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:

    4111.Capture2.PNG

    Using that you should see something like this:

    4111.Capture2.PNG

    Hope that helps.

    Bharat

  • Pega Profile Picture
    365 on at

    Thank you so much Bharat, it really helped.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans