0

I want the Highlighted content webpart to display news items filtered on RefinableString00 with the user.officeLocation.

The news pages have a sitecolumn with data (text) that's crawled & managed and connected to RefinableString00. I can see that the metadata is available with the SharePoint Search Query Tool:

Search displays refiablestring00

I can see that the user profile contains the correct value via the GraphAPI: User.officeLocation contains the same value

But I can't get the Highlighted content web part to filter based on the user profile. It does work when I hardcode "ITNews" in it. But whatever I do, the user profile options don't display anything. Different filter options I tried


Is it possible to filter based on the user profile? If so, what am I doing wrong? I'm feeling that I'm really close in getting it to work.


*I've found the following resources that got me this far:

  1. Highlighted content web-part should show data based on current logged in user's location
  2. https://www.sharepointeurope.com/filter-a-content-search-webpart-by-a-user-profile-property/
  3. SmartCAML
  4. SharePoint Search Query Tool*

1 Answer 1

0

I have tried your scenario and it seems that Highlighted web part does not support filter based on user profile property i.e. {ManagedPropertyName}:{User.{UserProfilePropertyName}}. However it's working when calling Search API.

Here best approach to use PnP Search Result Web Part where you can use below query which will give you expected result. PnP Search Result web part does also have similar design template.

RefinableString00:{User.SPS-Location}
1
  • I wondered where you found SPS-Location. After some digging I found that the User profile is synced via the user profiles and displayname "Office location" is indeed crawled with the user profile attribute "SPS-Location" (See: SharePoint admin portal - Mote Features - User Profiles - "Office Location"). After that I could get the Highlighted content webpart to display the correct news by setting it to "Custom query" and the following in the Query text: RefinableString00:{User.SPS-Office}
    – JPvdB
    Commented Dec 5, 2022 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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