Microsoft 365 SharePoint

How to Display Custom Metadata in the Advanced Search Web Part within SharePoint Online

For one of our Office 365 customers, I had to extend the SharePoint Advanced Search Web Part with additional properties:

SharePoint Online Advanced Search Custom Metadata

The customer has metadata applied within their Office 365 portals such as company, project name and project status. How can we add the metadata to the property menu within the web part? Just follow my lead!

You have to be a global administrator within your Office 365 tenant, otherwise you can’t configure all the necessary components. Our first stop is the Managed Property menu. Go to your SharePoint Online admin center and click Managed Search Schema. The following screen appears:
SharePoint Online Managed Search Schema Properties

Hopefully you are aware of the fact that SharePoint Online has limited options for new managed properties (more about this later) and that’s why Microsoft created a bunch of predefined managed properties. These are called RefinableDate, RefinableDecimal, RefinableDouble, RefinableInt and RefinableString. You can re-use these managed properties and connect them to your custom metadata. This is very useful for search results refiners, I wrote an article about this almost a year ago. The reason you use the predefined managed properties is immediately clear after you click New Managed Property:

SharePoint Online Advanced Search Custom Metadata You can’t use a new managed property as a refiner. The out-of-the-box Refinable managed properties are able to refine:

SharePoint Online Advanced Search Custom Metadata

Great! So here is where I made a big mistake. I used the predefined managed properties within the advanced search property menu. Guess what happened? Nothing, that’s what happened. The custom metadata didn’t appear in the advanced search property drop-down menu. Why not? This is why:

SharePoint Online Advanced Search Custom Metadata The Refinable managed properties aren’t searchable! The option is greyed out. This means you have to create a new managed property if you want to use the custom metadata within the advanced search. The following screen shows that new managed property is searchable:

SharePoint Online Advanced Search Custom MetadataLet’s just ignore the fact that this is very annoying and you are stuck with basically double managed properties for the same custom metadata. Did you create your new managed property? Checked the Searchable checkbox? Attached your crawled property? Alright, ready to move on to our second and final step! Edit the Advanced Search Web Part:

SharePoint Online Advanced Search Custom Metadata

Click within the Properties bar and three little black dots appear on the right side. Click these to open the Text Editor:

SharePoint Online Advanced Search Custom Metadata

Let’s ignore the fact that this is the most user unfriendly text builder in the world, so I normally copy the content to Notepad. Quick tip: Save the original code somewhere safe, in case you mess up. You have to add the custom metadata in the following sections:

<PropertyDefs>

<PropertyDef Name="YourManagedProperty" DataType="text" DisplayName="Name displayed in the drop down"/>

</PropertyDefs>
<ResultTypes>

<PropertyRef Name="YourManagedProperty" />

</ResultTypes>

Save the code back into the text builder. Click OK and then save the web part and publish the page. Let’s take a look at the drop-down menu with the custom metadata changes we just made:

SharePoint Online Advanced Search Custom Metadata
The custom metadata is now available. I hope you found this article useful and don’t have to struggle as much as I did. – See more at: http://www.itunity.com/article/display-custom-metadata-advanced-search-web-part-sharepoint-online-834#sthash.ofCY37bQ.dpuf

You Might Also Like

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.