SharePoint Online: Custom Search Refiner Display Templates

The Refinement Panel is a solid part of almost every classic search solution. In most cases we can configure the selected refiner perfectly by changing the settings, but not always. Fortunately we are also able to change the display template per selected refiner and create our own custom Refiner Display Templates. In this example I created a custom display template with the following customizations.

  • Removed the first two characters of the filter option.
  • Made the refinement panel wider.

More information about display templates in general can be found on MSDN Display Templates.

Create a custom Refinement display template

First we need to make a copy of the default refinement display template, the name of the display template is Filter_Default.

  • Navigate to the filter display templates: Master Page Gallery / Display Templates / Filters.
    (http://your-site/_catalogs/masterpage/Display Templates/Filters)
  • Copy the HTML file Filter_Default and give it a new name for example: Filter_Custom.html
  • Remember not to copy the JS file, this will be created automatically.
  • Update the Title field of the display template.
  • Open Filter_Custom.html in your favorite editor.
  • Remove the code which is not needed.
    • I removed rows 33-201 and 209-229
    • Note that this might be different for you

Solution for removing characters

  • Find the following code.
    <div id='Container'>
    
  • Find the following div located below the previous one.
    <div id='Value' name='Item'>
  • Between these divs add the if statement that shortens the shown filter options.
  • Note that is does not remove the show all items feature.
  • In my example I remove the first 2 characters.
    var refinementNameShorter=refinementName;
    
    if(refinementName!="All")
    {
        refinementNameShorter = refinementName.substring(2);
        refinementNameShorter = refinementNameShorter.substring(0, refinementNameShorter.indexOf("|"))
    }
    

Solution for wider refinement panel

  • Find the following code.
    <div id='Container'>
    
  • Inside this div is the following div located.
    <div id='Value' name='Item'>
    
  • Change this into the following code.
    <div id='Value' name='Item' style="width: 500px;">
    

Configure the refinement panel

  • Open the page with the refinement panel
  • Select by Display template the newly created Filter_Custom

Code result

SharePoint: New experience page in classic site

A customer wanted to use a web part, on a classic site page, that is only available for new experience (modern) site pages. This is not possible to do, we can however create new experience (modern) site pages in a classic site. I don’t recommend this often because the design of the pages are not equal and might confuse the users. In this post I will explain how you can do this.

Solution

  • Open the site pages library of your site.
  • Open the advanced settings of the library.
  • Select by List experience the option New experience
  • Open the site pages library and create a new site page in the library.
  • The page will be a new experience page.
  • If required set the List experience the option  back to Classic experience.

SharePoint: why you cannot Save Site as template

There are two reasons why you might not be able to save a site as a template. In this post I will explain what the reasons are and how you can figure out what is causing your problem. The first reasons is that the publishing feature is activated and the second reason is that custom scripts are not allowed.

1. Publishing  features activated

The most common issues is that the publishing feature is activated on the site or on a parent site. If you are trying to make a template of a subsite this will not work when the parent site has an active publishing feature.

  1. Open the site settings
  2. Click on Manage site features
  3. Check if the publishing feature is active
  4. Do this also for possible parent sites

‘Solution’ for subsite without Publishing active

I have never run into problems when using this method for subsites. However be careful it is not supported by Microsoft for a reason.

  1. Create the following URL for you specific site
  2. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

Truely not supported ‘solution’ when publishing is active

I don’t recommend using this so called solution, you can run into all kinds of issues. I do however want to mention this because you can find this all over the internet being claimed as an actual solution.

  1. Create the following URL for you specific site
  2. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

Second truely not supported ‘solution’ when publishing is active

I also don’t recommend using this so called solution, you can run into all kinds of issues. I do however also want to mention this because you can find this all over the internet being claimed as an actual solution.

  1. Open the site settings
  2. Click on Manage site features
  3. Deactivate the Publishing feature
  4. Create the following URL for you specific site
  5. [SiteURL]/_layouts/savetmpl.aspx
    or
    [SiteURL]/_layouts/15/savetmpl.aspx

2. Custom Scripts are not allowed

If publishing is not activated, it is possible that custom scripting is not allowed on the tenant level. You can see in the SharePoint Admin Center if its allowed or not. If you don’t have permission to do this you can also check it by using the following method.

  1. Open the site settings
  2. Click on Manage site features
  3. Do you see the following options? Then custom scripts are not allowed.
  4. Do you see the following options? Then custom scripts are allowed.

Solution to allow for custom scripts

  1. Open the SharePoint Admin Center in the Office 365 Admin Center

  2. Click on Settings and go to the Custom Script section.
  3. Choose “Allow users to run custom script” for Allow users to run custom script on personal sites and Allow users to run custom script on self-service created sites
  4. Click OK.
  5. It might take up to 24 hours before you can now save the site as an template.

SharePoint Online: File move and copy for modern document libraries

In the blogpost SharePoint Online: A few new features I briefly talked about the then new move and copy file feature. Microsoft release an update to extend the capabilities and making it even more useful. This update give you the ability to move or copy files anywhere in SharePoint with version management and metadata protection! Meaning that versions and metadata will be moved/copied with the file. The move and copy feature is very useful after or during a migration, users typically will restructure and move files to new locations to make better use of the new environment. During and after the migration project we did for Vestia users where able to quickly move files to new locations. You can read (in Dutch) all about the project on www.Macaw.nl

Move/Copy details

When moving or coping files to a different location the metadata will only be preserved if the destination by matching the column names. If there is no match then the metadata will be lost.
When you use data governance labels to control information policies for retention or records management those must exist in the destination location. If the destination does not support policies the move/copy action will be blocked. The move action will also be blocked if the version management settings are not the same in the destination.

Move files in Office 365

  • Select one or more files
  • Click on the Move to button
  • Select the destination location.
    Note that you can select OneDrive and any SharePoint Site you have access to.
    If your destination is not on the short list use browse sites  to find it.
  • Click on Move here to move the file of files.

Copy files in Office 365

  • Copy files works exactly the same, beside selecting Copy instead of Move.

Office 2016: Outlook My Templates

Today I want to briefly talk about the My Template feature in Outlook. This  great add-in makes it very easy to create simple templates for emails. I used the old way (see below) but this was not very user-friendly. With the new feature you can create and use simple templates with a very user-friendly  interface. The major difference is that we cannot add images in these templates, perhaps this well be added in the future.

Create a template

  1. Create a new email.
  2. Click on View templates
  3. Click on + Template
  4. Type the information for the template and save the template

Use a Template

  1. Create a new email.
  2. Click on View templates and select the template
  3. If needed add more information and send the email

Old way: Create a Template

  1. Create a new email.
  2. Type the information for the template (e.g., all the standard information).
  3. Click File and choose Save as.  Specify the template File name and Save as file type Outlook Template (.oft).  Be sure to save it in the default location for Microsoft Templates.
  4. Close the email and do not save it when prompted.

Old way: Use a Template

  1. Choose New Items | More Items | Choose Form.
  2. In the Look In: box, select User Templates in File System
  3. Select the form you wish to use and click Open
  4. You can now type the needed information and click Send.

SharePoint: Hub sites new in Office 365

Today at Ignite 2017, we (Microsoft) announced SharePoint hub sites, a new building block of the intranet, to bring together related sites to roll up news and activity, to simplify search, and to create cohesion with shared navigation and look-and-feel.   The digital workplace is dynamic and ever changing. Busi…

Source: SharePoint hub sites new in Office 365

With the new hub sites in Office 365 we can roll up all related team and communication sites in one location. This will provide the users with focused entry points to find everything about a topic. Even if the information is located on different sites. For every team and communication site we set the related hub site and if needed be change it. The hub site will show activities and information from all related sites and provide the user with a powerful search scope to search within all related sites. A faster and easier way for users to find what they need.

A big upside of using hub site is during a transformation of a company. Simply change the association for a site and it is ‘migrated’ to the new hub. No complicated migration process is required.