AnsweredAssumed Answered

Remove CSS from Body column in SharePoint 2013

Question asked by aurumpotabile on Jul 21, 2015
Latest reply on Jul 21, 2015 by aurumpotabile

I'm looking to send automatic email notifications when someone submits a file via email to a discussion list. I chose this list type because it allows us to capture an email's body text without any custom code or additional hassle. I've enabled the list to allow users to submit files in email as attachments.


The problem I'm running into is that a bunch of CSS comes embedded in the Body field, so when I get the email notification I have to wade through a bunch of irrelevant information just to get to the message. Here's some sample output:


B55C039C46B049E6B21E0D6DE226C908 .shape {



B55C039C46B049E6B21E0D6DE226C908 p.MsoNormal, B55C039C46B049E6B21E0D6DE226C908 li.MsoNormal, B55C039C46B049E6B21E0D6DE226C908 div.MsoNormal {







[. . . lots more of this, then the actual message:]


The attached file contains super important information.


While this isn't a huge deal for me, I can't expect my users to know what to look for. Is there a way to strip out (or force rendering of) CSS? My initial idea is to use functions to find the last occurrence of a closing curly brace and remove everything from the body's beginning to that index. If this is a good way to approach it, I'm not sure how to actually accomplish it and would appreciate assistance. However, if there's a better approach, I'm happy to entertain it.


Thanks for your advice!