SharePoint Client Object Model: Read MultiLineText as Plain Text

While working with SharePoint Client Object Model there might be a need to retrieve value of a multiline rich text as “plain text. Let’s show you how


static void Main(string[] args)
{
string siteUrl = "http://yoursiteUrl";

ClientContext clientContext = new ClientContext(siteUrl);
var web = clientContext.Web;
var list = web.Lists.GetByTitle("MyList");

var itemId = "1";
var listItem = list.GetItemById(itemId);

//load listitem values as text
var itemFieldValues = listItem.FieldValuesAsText;

clientContext.Load(itemFieldValues);
clientContext.ExecuteQuery();

//retrieve the multiline field value as text
string multitextValue = itemFieldValues["MyMultiLineTextField"];

}

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *