In this post I will look at managed properties for people fields in SharePoint

People field in SharePoint

I created a user field CVOwner on my document library (as a site collection column). Then I wanted this to be displayed in my search results web part. I updated my display template but the field didn’t want to appear. Time to look into how this all works.

Managed Properties for my people field

When SharePoint crawls the content which uses the CV Owner field a managed properties are created:

  • OLCVOwnerOWSUSER

Also there are two Crawled Properties:

  • ows_q_USER_OL_CVOwner
  • ows_OL_CVOwner

So what are these two Crawled properties? Is one not enough?

Some attempts to your solution

First I added a refinement panel showing my OLCVOwnerOWSUSER (I had to update the managed property to include the refinement option first) hmm, the data is appearing fine. But not in the refinement settings preview though. This could be a clue.

This preview screen uses a display template itself. Maybe display templates can’t handle user objects… No that can’t be it. If the refinement panel can display the data then so can any other display template.

I must be missing something. So in the DisplayTemplates Folder I looked in the Filters folder. There is a Control_Refinement display template and then a lot of Filter_* display templates, Ok, I’m using the filter_multivalue.html. This display template is able to display the user fields.

Your Solution

Then I looked at my web part properties.

<property name=”SelectedPropertiesJson” type=”string”>[“Title”,”AboutMe”,”AccountName”,”BaseOfficeLocation”,”Department”,”HitHighlightedProperties”,”Interests”,”LastModifiedTime”,”Memberships”,”PastProjects”,”Path”,”PreferredName”,”Responsibilities”,”Schools”,”ServiceApplicationID”,”SipAddress”,”Skills”,”UserProfile_GUID”,”WorkEmail”,”WorkId”,”FirstName”,”LastName”,”Office”,”WorkPhone”,”JobTitle”,”MobilePhone”,”PictureURL”,”Email”,”Floor”,”MapReference”,”Fax”,”Extension”,”CV”,”DisplayAuthor\n\t\t\t”]</property>

Adding my CVOwner field made the property available:

<property name=”SelectedPropertiesJson” type=”string”>[“OLCVOwnerOWSUSER”,”Title”,”AboutMe”,”AccountName”,”BaseOfficeLocation”,”Department”,”HitHighlightedProperties”,”Interests”,”LastModifiedTime”,”Memberships”,”PastProjects”,”Path”,”PreferredName”,”Responsibilities”,”Schools”,”ServiceApplicationID”,”SipAddress”,”Skills”,”UserProfile_GUID”,”WorkEmail”,”WorkId”,”FirstName”,”LastName”,”Office”,”WorkPhone”,”JobTitle”,”MobilePhone”,”PictureURL”,”Email”,”Floor”,”MapReference”,”Fax”,”Extension”,”CV”,”DisplayAuthor\n\t\t\t”]</property>

So now I’m getting some results:

The following is now displayed:

| Pieter Veenstra | 693A30232E777C6D796465765C7069657465722E7665656E73747261 i:0#.w|mydev\pieter.veenstra;Pieter Veenstra

Ok, these are indeed user details but not really what I want.

So I created a new mapping CVOwner and mapped this to the ows_OL_CVOwner crawled Property.

Now I’m getting my display name back.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading