Jun 22 2020 08:22 AM - edited Jun 24 2020 07:04 AM
Hi All,
My organization uses SharePoint Online, and I'm trying to set up a modern page that uses the "Highlighted Content" web part with some custom CAML or KQL filtering.
What I'd like to do is:
Users setting up this page won't necessarily be SharePoint experts, so I'm hoping once I get this working to turn this into a page template to automate the filter logic as determined by how the author tags each page.
I'm familiar with assigning the site column tot he page library, and I've seen references to CAML/KQL logic that filters by specific fields, but I haven't been able to tie it back to how the parent page is configured. Any assistance would be appreciated.
Thanks!
Feb 10 2021 01:07 PM
@AndrewWDC this is going to depend on whether you want to pull pages from multiple sites or just the same site the highlight content web part page exists in. If it's the former, you need a KQL query. If it's the latter, it'll be a CAML query. You'll also need to index the site column and find its corresponding Managed Property in your search settings.
Assuming you're looking in multiple sites, here's a KQL query that will get you all site pages:
ContentType:Site Page
now let's say you add a choice column named "PageType" and have two choices, "highlight" and "normal". First, it needs to be indexed. Then you need to go to your Search settings and look at Managed Properties. Search for your column name. In my case, the managed property is ows_q_CHCS_PageType. So my query can now be modified as follows:
ContentType:Site Page AND ows_q_CHCS_PageType:highlight
This will show me all Site Pages in all site collections that have had the PageType set to "highlight".
Hope this helps.
Jun 23 2022 02:28 PM