SharePoint Online missing Search template

Troubleshooting in a modern Software-As-A-Service (SaaS) like SharePoint Online is not my interest. Last week I had a customer who asked to look into an out-of-the-box Search problem in SharePoint Online. When searching on the search box, SharePoint Online throws out the message below:

Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.

Template ‘~sitecollection/_catalogs/masterpage/Display Templates/Search/Control_SearchBox.js’ not found or has syntax errors. (LoadTemplate: )

The error seems to indicate that SharePoint Online does not reach to call built-in Search JavaScript files in Display Template folder. The very first thing to do is verify if Display Template is still in Master Page Gallery library (Site Settings > Master pages and page layouts). Unfortunately it was not there. I remembered the Search Server Web Parts and Templates feature in which Microsoft describes that if we see missing template error, activate the feature.

After a few times trying to activate and deactivate with the hope that the Display Template would be automatically provisioned, but no luck.

I came to the decision to copy the Display Templates folder in a newly created site collection to the missing one. Firstly, I connected to my site collection using SharePoint Designer. I then created a new folder in the path (site collection > All Files > _catalogs >masterpage) named Display Templates. During the copy, SharePoint Designer responded to me there was a conflict because Display Templates still existed in the masterpage folder. I checked every language pack folder and finally found it. The last step was to move it to the masterpage folder and try to search again.

Perhaps someone accidentally dragged Display Templates folder into a language pack folder when working with SharePoint Designer that SharePoint Online was not able to locate correctly. This is a real-world experience of troubleshooting. This post would be helpful at least if you are in the urgent situation troubleshooting SharePoint Online.


Leave a Reply

© 2018 The Soldier of Fortune.