0

I am working on a custom people search page, one of requirement is about to populate a rich text user property created in User Profile Service. But the crawled property created by SharePoint is only text field, which removes all the html markups.

For example, if multi-line text has been saved in AboutMe html field, when it gets display through person search template, the end of the first line joins with first word from second line. And all markups are gone.

I've tried to use ctx.CurrentItem.??? and $getItemValue(ctx, "???"), nothing could get what I am looking for.

Could someone help me with this, please?

1

Are you sure you are using the AboutMe managed property? I have several User Profiles with MANY lines of text in the About Me user profile field. When I look at the Item_Person display template I see that there is a function to assist in the rendering of the AboutMe managed property. It looks for Hit Highlighted properties and if it doesn't find it there it reverts to ctx.CurrentItem.AboutMe.

$htmlEncode(Srch.U.getTrimmedString(ctx.CurrentItem.AboutMe, 125))

In my test I tried just outputting the field without any script and had no issues. When I added any markup I saw what you saw. It appears that the markup is being removed. I also created a new field, in case it was bound only to the AboutMe managed prop, and got the same results.

If I needed to resolve this I would use CSOM to request the User Profile property from the UPS and render the field myself in the Display Template. With CSOM and REST you can get the full contents of the field.

  • Yes, I can get this working just like you had up there, but what if you give it a H1, or font color, and adding a new paragraph in a separate line in the AboutMe field or any custom HTML type field. It still brings plain text, so first paragraph and second paragraph end up joining together in the output value. It looks like the crawled property (text) does removes all html markups. That's the issue I had. And SharePoint doesn't seems create an ows_r_HTML_* for any html field in User Profile. – Alan Aug 2 '16 at 21:10
  • It appears that Content Processing or some other action is removing the HTML markup from the field. The ows_r_HTML_* fields are only created for Site Columns, not User Profile or BCS crawled properties. – Matthew McDermott Aug 3 '16 at 14:52
0

Please make sure you map the right property

enter image description here

The crawled property ows_xxx is the text only property.

The crawled property ows_r_MTXT_xxx is the rich text property.

  • Thanks. However what I found is those ows_r_MTXT are only for publishing site column, not for User Properties. – Alan Aug 2 '16 at 6:40

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.