The launch of Viva Connections has once again put Microsoft SharePoint in the center of attention when it comes to building intranets or digital workplaces in Microsoft 365, especially for smaller businesses. One key success factor when creating a modern intranet is to provide users with relevant content that provides value to them in their day-to-day work.
Modern SharePoint Online contains functionality for targeting different types of content to different users. You target content by selecting one or more Azure AD groups and the content is then displayed only to members of those groups.
You can target many different types of content, including documents, quick links, calendar events and perhaps most importantly: News articles.
It is very easy to activate audience targeting, apply it to content, and configure e.g. the News webpart in SharePoint to adhere to the targeting when listing news articles. But what about the search experience?
The default “News” vertical in Microsoft Search lists all news articles the user has permissions to read. This might not be the desired behavior if you are looking at giving your users a relevant search experience. Luckily we can fix this.
In the following sections we will setup two custom search verticals: My News and Other News to make sure that it is easy for users to find news that are relevant to them.
Creating the My News search vertical
To create a new search vertical in Microsoft Search you must be a Search Administrator or Global Administrator in the Microsoft 365 tenant. Navigate to https://admin.microsoft.com/Adminportal/Home#/MicrosoftSearch/verticals. This is the interface where you can modify existing search verticals or create new ones.
Click on “Add” to start creating a new vertical.
The first step is to give the vertical a name, let’s call it “My News”.
Click Next to go to the Content source selection step.
Make sure “SharePoint” is selected and click Next.
Now we have arrived at the most important step, the Query section. It is here we have the chance to enter a KQL query to define which types of search results we want to show in our search vertical. Enter the following text in the text box:
PromotedState:2 AND
(ModernAudienceAadObjectIds:{User.Audiences} OR NOT IsAudienceTargeted:true)
Let’s break this query down, bit by bit:
PromotedState:2
tells the search engine to only return modern SharePoint news articles.ModernAudienceAadObjectIds:{User.Audiences}
is the magic part, telling the search engine to only fetch articles that are tageted to the current user.OR NOT IsAudienceTageted:true
, makes sure that articles without targeted is also fetched.
Click Next to go to the Filter section. This gives you the option to add a list of filter that users can use from to further narrow the search results.
Click Next again to go to the Review step. Make sure the information is correct, and then click on Add Vertical.
Finally, the vertical needs to be enabled. Do this by clicking on the Enable vertical button.
Creating the Other News search verticals
To create a search vertical that include only news articles that are not targeted to the current user (the news articles that we do not show in the My News vertical), follow the steps outlined in the section above but change the Query to look like this:
PromotedState:2 AND IsAudienceTargeted:true AND NOT ModernAudienceAadObjectIds:{User.Audiences}
Testing the new verticals
It can take some time (hours) for new or updated search verticals to show up to end users.
If you want to see them right away, navigate to the search results page and append cacheClear=true
to the URL, e.g. https://m365xcontoso.sharepoint.com/_layouts/15/search.aspx?q=*&cacheClear=true
Now you are ready to perform a search and try out the two new verticals!
Recent Comments