3

First off I want to be clear I am using the Silverlight Client Side Object Model in solution. So I cannot use objects/properties from the server object model.

What I am trying to do is get the plain text value of a field that is an enhanced rich text field. I know that I can use a RegEx to strip out the HTML, that is not what I am looking for as I would also have to deal with the character entities, etc. I am sure that I can find something pre-canned on the Internet but I would like to know if there is a native way of doing this in the CSOM.

I have tried some of the strategies in this thread (rich text to plain text), but have not managed to adapt them to the Silverlight CSOM.

2 Answers 2

4

Apparently it was far easier than I expected...

item.FieldValuesAsText[FIELD_NAME]

instead of item[FIELD_NAME]

So...

string businessCase = item["Business_x0020_Case"] != null ? item.FieldValuesAsText["Business_x0020_Case"] : string.Empty;
0

I know the RegEx solution may not be your ideal solution, but it is indeed the least complicated. As for the character entities, etc., you can use HtmlDecode to decode any HTML character markups to plaintext.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.