Jaa


Using site columns to create searchable metadata in SharePoint Online (Office 365)

A SharePoint site column[1] is a field definition that defines data or metadata that can be associated with items in a list or documents in a document library[2], and is a widely used technique in customizing SharePoint.  This article will review how site columns can be used in SharePoint Online, both in adding custom metadata values to Microsoft Word or other Office documents, and also using this property do a fielded search.   We conclude with the steps to configure the site column term as a refiner on the search results page.

To investigate this functionality we'll consider a hypothetical requirement to mark each document stored in a site's document library with a Color label, choosing from one of a small set of values.  We begin by creating a site column in our Office 365 SharePoint site[3] from the Site Settings page of the site collection, and add it to the group Custom Columns.  By selecting data type Choice, we can list the explicitly allowed values of either Red, Yellow, Green or Blue.

The Description section provides an opportunity to provide an explanation of what this field is to be used for, and whatever text is added here will be shown in the document upload form to help the users make an appropriate choice of value.

It is then added to the site's shared document library as a default column, via the Library Settings interface on the Library tab of the document library, by clicking the "Add from existing site columns" option.

If we then upload an existing word document to this library, the form will prompt for this new property, and supply the default value that was specified when the site column was created.

The next interesting case is to create a Word 2016 document with this metadata setting as a built-in custom property, to verify that it would be recognized during the upload to SharePoint Online and mapped to the existing site column.  Adding a custom property to a document is described in the Office.com support pages [4], and won't be spelled out here.  For our testing we created a custom property named Color of type Text in a Word document (via the Advanced Properties, Custom tab), and gave it a non-default value matching a one of the choices created in the SPO site column.  The SharePoint Online upload process did successfully read this value from the Word 2016 document, and displayed it as the default value in the upload form.

 

A SharePoint Online site crawl generally picks up new content within a short period of time, so after some interval the document should be returned in search results for an appropriate query.  Site column fields will be picked up in the crawl as a Crawled Property and mapped to a Managed Property[5], with both of them created automatically as necessary.  More details on how the automatically created crawled and managed property names are determined have been documented in a blog post[6], and in this specific case the property names, incorporating the field name and data type of the site column, would be:

Crawled Property Managed Property
ows_q_CHCS_Color ColorOWSCHCS

On the SharePoint Online site a search for ColorOWSCHCS:Red returned the test documents uploaded with that setting, but not others with value “Yellow”.

While having this automatically created Managed Property available is helpful, it is not particularly user-friendly and  lacks the full support of a custom created Managed Property, in particular the ability to use it as a refiner.  In SharePoint Online this can be configured via the tenant's Search Schema interface by modifying one of the numerous unused predefined Managed Properties[7], giving it a user-friendly Alias matching the document property name.  In this case, we'll utilize the RefinableString00 property, giving it the Alias value Color, and map the automatically created ows_q_CHCS_Color crawled property to it.

This customization improves the metadata search experience, as shown below, and will also enable its use as a refiner in the query results.

Customization of the search results page is done by first choosing "Edit Page" from the Settings cog , then selecting Edit Web Part from the pulldown in the Refinement web part on the left side of the page in the Navigation Zone.

By clicking the "Choose Refiners" button on the resulting Properties menu, the RefinableString00 refiner is added to the "Selected Refiners" list, and given the display name Color.

After using the "Move Up" button to put this new navigator at the top of the "Selected Refiners" list in the Refinement web part, the Color refiners are displayed for search results and available to filter the results to the appropriate selection.

While the focus of this article has been on customization of SharePoint Online, the techniques described here are also  available in on-premises SharePoint installations.  For further background on aligning document properties and SharePoint columns, see the blog "Document Property Promotion and Demotion Overview and Considerations" [8].

References:

[1] "Building Block: Columns and Field Types" - https://msdn.microsoft.com/en-us/library/ee535893.aspx

[2] "Introduction to Columns" general SharePoint overview - https://msdn.microsoft.com/en-us/library/ms450825.aspx

[3] SharePoint Online "Create a site column" -  https://support.office.com/en-us/article/Create-a-site-column-844EBA84-C32E-490E-9709-FD7DC84C6914

[4] "View or change the properties for an Office 2016 file" - https://support.office.com/en-US/article/View-or-change-the-properties-for-an-Office-2016-file-672540d1-019c-46bb-8a48-2e05770c4b9b

[5] "Manage the search schema in SharePoint Online" - https://support.office.com/en-us/article/Manage-the-search-schema-in-SharePoint-Online-d4fab46d-ba41-4c03-9d4c-32b5b33198b6

[6] "From site column to managed property – What's up with that?" - https://blogs.technet.com/b/tothesharepoint/archive/2013/03/06/from-site-column-to-managed-property-what-s-up-with-that.aspx

[7] "Create a managed property by renaming an existing one" - https://support.office.com/en-US/article/Manage-the-search-schema-in-SharePoint-Online-D4FAB46D-BA41-4C03-9D4C-32B5B33198B6#__ref341260321

[8] "Document Property Promotion and Demotion Overview and Considerations" - https://blogs.technet.com/b/wbaer/archive/2014/08/29/document-property-promotion-and-demotion-overview-and-considerations.aspx

Comments

  • Anonymous
    January 08, 2016
    Dan Harrington is a member of the Search Engineers PFE team. While assisting a colleague with a customer