I am having problems with a Highlighted Content WebPart in SharePoint Online where I am using a custom CAML query to filter content from a Page Library on another site collection.


I have created a site collection where I have a Page Library with 2 custom columns to filter the Pages in the Page Library.

On another site collection I have added a Highlighted Content WebPart where I need to query the 2 custom managed metadata columns to filter the pages that should be shown.

Custom Columns:

BusinessFunctions (Managed Metadata)

  • Sales

  • Marketing

  • Technical

BusinessRoles (Managed Metadata)

  • Director

  • Dept. Manager

  • Sales Rep

  • Technicians

Example Pages Library Content:

Title Business Function Business Role

Home.aspx Marketing Director

Page1.aspx Sales Director

Page2.aspx Sales Sales Rep

Page3.aspx Technical Dept Manager

These 2 columns have been added to the Pages Content Type. I have also checked that they exist as a managed property in the Search Schema and they are both listed as managed properties "owstaxidBusinessFunctions" and "owstaxidBusinessRoles".

If I use the Out of the Box filters I cannot create a filter with an AND statement as adding 2 of the same column results in an OR query statement as shown below.

REF: https://support.microsoft.com/en-us/office/use-the-highlighted-content-web-part-e34199b0-ff1a-47fb-8f4d-dbcaed329efd?ui=en-us&rs=en-us&ad=us

This means I need to create a CAML query to resolve the challenge but I cannot get the Query to work across site collections?

Here is an example of the type of query I want to create so I only return Pages with the BusinessFunction Marketing and BusinessRole Director.

I have also tried to create a very simple query with a single property but this doesn't work either across site collections?

                  <FieldRef Name='BusinessFunction' />
                  <Value Type='TaxonomyFieldType'>Marketing</Value>
                  <FieldRef Name='BusinessRole' />
                  <Value Type='TaxonomyFieldType'>Dept Manager</Value>
               <FieldRef Name='BusinessRole' />
               <Value Type='TaxonomyFieldType'>Technician</Value>
            <FieldRef Name='BusinessRole' />
            <Value Type='TaxonomyFieldType'>Sales Rep</Value>

I hope someone can help me to resolve this issue. Thanks! :)

1 Answer 1


I think you need to read this Highlighted Content CAML Query help which says KQL is for this type of situation.

Select customer query, then for Source choose "Select sites" and tick the boxes for the other site collection.

Then in the Query Text (KQL) box enter something like:

owstaxIdBusinessFunction:'Marketing' NOT ( owstaxidBusinessRoles:Technician OR owstaxidBusinessRoles:'Dept Manager' OR owstaxidBusinessRoles:'Sales Rep')

When you hit apply you should see the files you're expecting coming back (IF they've been indexed by search) BUT In your question you have owstaxidBusinessRoles and in the CAML BusinessRole You have to be VERY careful with spelling and capitalisation.

I hope this helps someone else with similar issues.

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.