Tuesday, September 15, 2015

Adding icons to Visio 2013 files in search results

clip_image001

It’s been a while since Microsoft launched Office 2013, and with Office 2016 soon coming out they still have not thought about giving Visio 2013 files a file icon in the search results.

The issue is two-fold. The Result Type used to pick the default Office display template and the JavaScript function Srch.U.getFriendlyNameForFileExtension (Search.ClientControls.js) are only matching on pre-2013 file extensions.

I’ve created some files to remedy this for anyone interested. The files can be found over at https://github.com/wobba/Scripts/tree/master/VSDX-Patch

When you run RegisterVisioIcon.ps1 against a site collection it will upload mAdcOW.VisioOverride.js to the Site Assets library as well as register the patching JavaScript to be loaded via a custom action. A search configuration file is also uploaded to the site collection with a result type registering all the Visio 2013 file extensions.

The only thing not handled is making the files appear in the Result Type refiner. If you make a copy of the filter_default.html file you can fix this yourself by adding the 2013 extension in the mapping function (Search for Visio and you will find it)

You can run this against your search center or any other site which uses osssearchresults.aspx.

clip_image002