16 Okt 2010

Remove HTML Tags when Obtaining Text from SharePoint Field

This is one of simple trick to use when you start to develop SharePoint Web Parts. When you want to get the text of, let’s say “Page Content” field of Pages Library, or any other formatted text field in HTML, and you want to get it without the formatting, then here we go the trick.

You can use SPHttpUtility.ConvertSimpleHtmlToText, with 2 arguments, the HTML formatted text, and the maximum length. And you can use other SPHttpUtility objects or any objects in Microsoft.SharePoint.Utilities to do another tricks. You don’t need to get any further code to get this and that, just point to Microsoft.SharePoint.Utilities, and you’ll get the tricks.

Tidak ada komentar:

Posting Komentar

[give me your ideas, hopes, comments and compliments below...]
[aaand...... +1 if you need to....]