0

I need to get enriched multi line text field value of a list item in SharePoint online SPFX web-part and display the field value in a table column without loosing its html property also hiding html tag displaying along with the field value.

Currently I get all fields of a list item by using the code:

const siteweb = Web(this.props.site);
let item: [] = await siteweb.lists.getByTitle(this.props.list).items.getById(propKey[this.props.propertybagid]).fieldValuesAsText.get();
2
  • Why are you using "fieldValuesAsText" ? in your call? Is it a multiline rich text field? Or try fieldValuesAsHTML – harshal gite Feb 4 '20 at 6:25
  • i need to get the hyperlink field values along with this that why i used it – Bini Jacob Feb 4 '20 at 6:26
0

If you are using React JS and getting the multi-line field text in HTML tags format then you can bind its value to div element as:

<div dangerouslySetInnerHTML={{__html: this.state.multilineFieldVale}} />;

Where this.state.multilineFieldVale stores the value of your multi-line field.

documentation: React DOM Elements - dangerouslySetInnerHTML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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