How To Get The Text Value Rather Than The HTML Value Of A MultiLine ListItem Using SharePoint Client Object Model



TODO:

You have a multi-line field in a list.  When you get the value, it comes back as HTML when you reference it as item["field"].  To get the text, rather than the HTML, you need to do the following.

 

SOLUTION:

//put at top!!!
using SP = Microsoft.SharePoint.Client;
 
//put inside class !!! 
SP.ListItem targetItem = null;
//todo, set your targetItem = to the item you want.
 
using(ClientContext clientContext = new ClientContext("http://your.url.goes.here"))
{
     var itemFieldValues = targetItem.FieldValuesAsText;
     clientContext.Load(itemFieldValues);
     clientContext.ExecuteQuery();
}
string fieldTextValue = itemFieldValues["My item Title"];

 

NOTES:

There are no notes on this topic.