“JavaScript-only” deployment of display templates

In most articles concerning the deployment of search display templates to SharePoint the method described is to copy one of the existing html design files in the “/_catalogs/masterpage/display templates” folder and save it with a new name in the same folder. But, when deploying from Visual Studio or from a package wsp, I think a good approach is to deploy the JavaScript file only. The reason for this is that you avoid the problem of manually republishing the html file after deployment, and, if you are an experienced JavaScript developer, you can work with JavaScript only.

The steps I usually follow in my development environment is as follows:

  1. Copy a html design file for an existing display template (for example the “Item_TwoLines.html” for CSWP item display templates)
  2. Save it to the same location, but with a different name (for example “Item_MyTemplate.html”)
  3. Copy the automatically generated JavaScript file (which will have the name “Item_MyTemplate.js”)
  4. Delete the two files from the display template library in SharePoint
  5. Create an empty module in your SharePoint project in Visual Studio and give it a name and an Url as shown below
  6. Add an element for your new template as shown below
    1. Remember to set “Level” to “published” and “ReplaceContent” to “true” in order for simpler solution upgrade
    2. The property “ManagedPropertyMapping” should be set to contain the fields that you need to use in the display template. The same managed property mappings should be specified in the JavaScript also, as shown below
  7. Deploy the template and test it!


Custom e-mail content in a SingleTask activity in SharePoint 2013 Workflows

When creating a SharePoint 2013 workflow in Visual Studio 2013 you might want to assign a task to a person involved in the workflow. This can easily be done by using the built-in SingleTask activity. Here is an example of such an activity:


  Continue reading

Search Service Application stuck in “Paused for:External request”

If you discover that the search service application in your environment is paused (look under “administrative status” under Search Administration in Central Administration), you can first try to find the reason, and if the service is stuck, you can try to force it to resume. Typically, the administrative status could be “Paused for:External request”. If you have this issue, start SharePoint 2013 Management Shell and do the following Continue reading

Localize JavaScript files in SharePoint

In a project I was working on, I needed a way to localize strings in JavaScript files in order to support different languages in the application. The solution was designed to be a SharePoint sandboxed solution, so we could not deploy custom resx files to the file system (this article by Waldek Mastykarz explains how to use ScriptResx.ashx to be able to refer to resource strings inside JavaScript files).

In order to solve the problem, we added one JavaScript file for each language and named it res.cc-ll.js Continue reading

Setting default value of person field in SharePoint 2013 with JSLink

Often, there is a need for setting a default value in a person field. In this article, we will have a look at how to set a person field value to the current logged in user. This involves using the Client People Picker with JSLink for rendering the field in the new form and using the JSOM SharePoint API to get information about the current logged in user. Continue reading

Failed to install application files – SharePoint 2013 SP1

Today, I was upgrading a SharePoint 2013 development server that had been “laying low” for a while to Service Pack 1. The installation itself went without any problems – I downloaded the SP1 executable from Microsoft and ran the installation.

After the installation, it was time to run the SharePoint Products Configuration Wizard, and I encountered the following error in step 8: “Failed to install application files”. In more details, the exception in the log file was:

Failed to install the application content files. Continue reading