SharePoint Online Highlighted Content Web Part

In this SharePoint Online tutorial, we will discuss the SharePoint online highlighted content web part. Let us discuss the below topics:

  • What is a highlighted content web part in SharePoint Online
  • How to configure and use the highlighted content web part
  • SharePoint online highlighted content managed property
  • highlighted content web part managed property filter
  • SharePoint online highlighted content kql
  • SharePoint online highlighted content list
  • SharePoint online highlighted content folder
  • highlighted content web part custom query
  • Highlighted Content Webpart CAML Query filter not working

What is a SharePoint Online highlighted content web part

What is a SharePoint Online highlighted content web part? Highlighted content is a modern SharePoint web part, that we can use to display documents dynamically from a document library, a particular site or site collection, from various site collections, or from All sites in SharePoint Online. It will be available in SharePoint Online modern experience.

The highlighted content web part is also available in SharePoint server 2019 modern experience. It will not appear in classic SharePoint sites.

Note: Maximum of 200 items can be returned and displayed.

Add Highlighted Content Web Part

Let us see how to add the Highlighted Content web part to a SharePoint page.

Open the SharePoint Online site, and navigate to the page where you want to add the web part. Here I have created a site page in a modern SharePoint Online team site in Office 365.

Edit the page and then click on the Plus (+) icon. The search for the “Highlighted” and you can see the Highlighted content web part, click to add the web part to the page.

sharepoint online highlighted content
sharepoint online highlighted content

Once you add it, by default it will display 8 most recent documents from the SharePoint site like below, simply you can Publish the page if you want to display the recent documents.

sharepoint online highlighted content web part
sharepoint online highlighted content web part

But let us see what are the configuration options available in the highlighted content web part in SharePoint Online or SharePoint 2019.

Configure highlighted content web part

Let us see various configure options available in the highlighted content web part. Click on the Edit web part properties icon like below, it will open the web part properties panel.

highlighted content web part
Edit highlighted content web part

In the web part properties first you can select the the filter or custom query. There are two options:

  • Filter
  • Custom query
sharepoint online highlighted content data source
sharepoint online highlighted content data source

Let us see how to the Filter works in the highlighted content web part.

Content Source

First, we define the content source, from where we can display the documents. You have the option to choose the content source from the below options:

  • This site: If you want to display the document from this site.
  • A document library on this site: If you will select the option, it will allow us to choose a particular document library from where you want to display the documents.
  • This site collection: If you will select this option, it will display documents from the top-level site as well as the subsite presented under the SharePoint Online site collection.
  • The page library on this site: This will display the documents from the Pages document library. This will be helpful if you have various site pages created like news or event pages.
  • Select sites: When you select this option, it will allow you to select sites from where you want to display the documents.
  • All sites: If you will select All site, the documents will be displayed from all the sites from all your SharePoint sites.

You can see below:

highlighted content web part content source
highlighted content web part content source

Content Type

In the next, we can set the content type. Like you can select what kind of content you want to display:

  • Documents
  • Pages
  • News
  • Videos
  • Images
  • Events
  • Issues
  • Tasks
  • Links
  • Contacts
  • All

If you want to display only documents, then you can select the Documents option, similarly, if you want to display videos, you can select videos, etc.

highlighted content web part content type
highlighted content web part content type

Document Type

If you want to display only a word document, or excel document, etc, then the Document type will be very much helpful. Here it will allow us to select what type of documents we want to display like Word, Excel, PowerPoint, OneNote, Visio, PDF, or Any.

If you want to display any kind of document then select Document type as Any.

highlighted content web part document type
highlighted content web part document type

Highlighted content web part filter and sort options

The SharePoint Online highlighted content web part provides various Filter and sort options.

Highlighted content web part filter and sort
Highlighted content web part filter and sort

We can filter from below options:

  • Title includes the words
  • Content includes the words
  • Recently added
  • Recently changed
  • Created by
  • Modified by
  • Managed property

Even we can filter based on Title includes the words “card” and it will display those document that contains the keyword in the document title.

sharepoint online highlighted content filter
sharepoint online highlighted content filter

Similarly, we can filter documents based on created by the current user or by a specific user.

sharepoint online highlighted content filter by created by
sharepoint online highlighted content filter by created by

SharePoint Online highlighted content web part provides various sorting options to sort the documents.

You can sort by:

  • Most recent
  • Most viewed
  • Trending
  • Managed property ascending
  • Managed property descending
sharepoint online highlighted content sort
sharepoint online highlighted content sort

SharePoint online highlighted content audience targeting

We can also set audience targeting in the SharePoint online highlighted content web part. Once you set audience targeting, you can show content to a targeted group of people.

Like you can display contents that will be specific to your HR people or Finance people.

To use audience targeting we have to enable audience targeting in the library first that contains the documents.

Then we can enable audience targeting in the highlighted content web part like below:

SharePoint online highlighted content audience targeting
SharePoint online highlighted content audience targeting

Layout

SharePoint online highlighted content web part provides 4 layout options:

  • Grid
  • List
  • Carousel
  • Filmstrip

You can select one from the above layout options. Below you can see how the documents will appear in the List layout option.

sharepoint online highlighted content web part layout
sharepoint online highlighted content web part layout

You can change the highlighted content web part layout like above.

SharePoint online highlighted content web part limit items

We can also limit the number of items to display in the highlighted content web part. By default, it will display 8 items and we can display up to 500 items.

SharePoint online highlighted content web part limit items
SharePoint online highlighted content web part limit items

Hide highlighted content web part

We can hide the highlighted content web part in SharePoint online, if there is not item to show.

Just check the checkbox, Hide this web part if there’s nothing to show option in the web part properties like below:

hide highlighted content web part
hide highlighted content web part

This is how we can add and use the SharePoint online highlighted content web part.

SharePoint Online highlighted content managed property

Now, let us see how to use a managed property to filter documents in the SharePoint online highlighted content web part.

In the Filter section, choose Managed property and then you can enter a few letters to find the managed property. Then it will populate the Managed property in the Managed property name dropdown list.

Here I have a site column as TSInfoDepartment and I have added into the document library. The site column has choice values like HR, Finance, IT etc.

Here I have filtered the documents so that it will display the documents where the department in HR. This is a very efficient way of filtering documents based on the managed property.

It is showing only those documents where the department in HR (in this case I have only 2 documents)

sharepoint online highlighted content web part
sharepoint online highlighted content web part

SharePoint online highlighted content custom query

Let us see how to use SharePoint Online highlighted content custom query to filter documents.

We can use either, Keyword Query Language (KQL) or Collaborative Application Markup Language (CAML) for this.

Let us check out how to use both of them.

SharePoint online highlighted content kql

SharePoint highlighted content web part provides options where we can the KQL query syntax to filter the documents. If you want to know more about the KQL syntax, check out this MSDN URL.

In this case first select Custom query option.

Then to use KQL (Query Text), make sure to chose the Source anyone from the below:

  • This site
  • This site collection
  • Select sites

Then in the Query text (KQL), enter your query and click on Apply.

You can see here I have entered as title:”Bijay”, so it displays documents where the title contains the word “Bijay”.

sharepoint online highlighted content kql
sharepoint online highlighted content kql

This is how we can use SharePoint online highlighted content kql filter option.

SharePoint online highlighted content CAML

As a part of SharePoint online highlighted content custom query, we can also use CAML to filter documents from a document library and display those documents.

If you want to use CAML, then the data source should be either Document library or Pages library on this site. For these two sources, then the CAML query will work.

Once you select the source “A document library on this site”, it will populate all the lists and libraries, you can select the library that you want to display the items.

In this case, I have selected the default Documents, document library.

Then the CAML query I generated using a CAML query builder and then paste the code in Query text (CAML) textbox like below, it displaying documents having Department as IT like below:

<View>
<Query>
   <Where>
      <Eq>
         <FieldRef Name='TSInfo_x0020_Department' />
         <Value Type='Choice'>IT</Value>
      </Eq>
   </Where>
</Query>
</View>
sharepoint online highlighted content caml
sharepoint online highlighted content caml

This is how we can use CAML in SharePoint Online highlighted content custom query web part to filter documents.

If you are new to CAML, you can check out CAML syntax in this MSDN article.

SharePoint online highlighted content folder

As of now, highlighted content web part does not have the option to display items from a particular folder from a document library.

SharePoint online highlighted content list

We can also display items from SharePoint lists in the highlighted content web part in SharePoint Online.

The below teamplates are supported as of now:

  • Events
  • Issues
  • Tasks
  • Links
  • Contacts etc.

In the below example, you can see I have selected Source as This site, Type as Contacts, and then in the Filter, I have added a text to Title includes the words as “Sahoo“.

In this SharePoint site, I have two contact lists, and now you can see here, the highlighted content web part is displaying items from those two contact lists where the title is “Sahoo”.

SharePoint online highlighted content list
SharePoint online highlighted content list

This way we can display items from SharePoint lists in a highlighted content web part in SharePoint Online modern site in Office 365.

Highlighted Content Webpart CAML Query filter not working

Highlighted Content Webpart CAML Query filter not working, this issue you might get, while trying to filter items using a custom filter and especially using CAML query.

When you will generate a CAML query using CAML query builder in SharePoint Online, then it will return the query like below:

<Query>
   <Where>
      <Eq>
         <FieldRef Name='TSInfo_x0020_Department' />
         <Value Type='Choice'>IT</Value>
      </Eq>
   </Where>
</Query>

To fix this problem, we need to make sure to add the <View> </View> tag like below:

<View>
<Query>
   <Where>
      <Eq>
         <FieldRef Name='TSInfo_x0020_Department' />
         <Value Type='Choice'>IT</Value>
      </Eq>
   </Where>
</Query>
</View>

Ideally, it should look like below:

Higlighted Content Webpart CAML Query filter not working
Higlighted Content Webpart CAML Query filter not working

This should fix the issue, Higlighted Content Webpart CAML Query filter not working in SharePoint Online.

You may like the following SharePoint tutorials:

In this tutorial, we discussed in detail on SharePoint online highlighted content web part and the below points:

  • What is a SharePoint Online highlighted content web part
  • Add Highlighted Content Web Part
  • Configure highlighted content web part
  • Highlighted content web part filter and sort options
  • SharePoint online highlighted content audience targeting
  • SharePoint online highlighted content layout options
  • SharePoint online highlighted content web part limit items
  • Hide highlighted content web part
  • SharePoint Online highlighted content managed property
  • SharePoint online highlighted content custom query
  • SharePoint online highlighted content kql
  • SharePoint online highlighted content CAML
  • SharePoint online highlighted content folder
  • SharePoint online highlighted content list
  • Highlighted Content Webpart CAML Query filter not working
>