As it seems hypens in Managed Properties are still an issue in SharePoint 2016 / 2013. I had an issue with an existing business application and did some tests to find out more.

I created two managed properties "testdummy" and "test-dummy" with exactly the same settings and the same mappings to the crawled property "Title".

If I use "testdummy" and "test-dummy" in a query term (enterprise result page)




I get exactly the same results. Trying the same from the SharePoint Search Query Tool, it also works.

Even using one of those as a refinement property, by editing a refinement panel it also works like a charm.

Until now those properties where created for the exclusive use by external Rest Search calls, and even there (get and post calls), it worked.

But not inside a display template. In order to use the property inside a Display Template I took a copy of an existing display template and added the properties one after another to the ManagedPropertyMapping Setting

<mso:ManagedPropertyMapping msdt:dt="string">'testdummy':'testdummy',

After that I verified the modification by looking at the automatically created javascript equivalent.


Looked good and worked as expected.

Then I tried the same with the test-dummy property.

<mso:ManagedPropertyMapping msdt:dt="string">'test-dummy':'test-dummy',

and verified in the js file


But if I now use that template (no calculation is done with the property, just added to the mapping section), the only response on the page is a correlation ID.

Searching in the ULS Log I can find this information:

The field name 'test-dummy' is not valid. Field names can only contain English letters, digits, the underline character '_', and the punctuation mark '.'

Any idea how I could "escape" that issue in a display template? In any other Use case I have, it works like intended.

1 Answer 1


Hyphens in managed property names are a bad idea. If you consider that KQL uses the hyphen to negate the terms that follow, for example: Matthew -LastName:McDermott

Will return items with the keyword "Matthew" but not the LastName "McDermott".

In my experience with SharePoint on-prem and online, if you introduce a managed property with a hyphen the query parser will not understand your query.

  • I know about the issue within KQL, and like I have written in my Question with the addition of quotation marks -> "test-dummy" you can still use it in KQL. As it is an already existing business application which has been running quite some time and all Use Cases (Query, Refinement, Rest-call,…) work. My question was if there is a way to do the escaping in a display template. If not, I already know that the whole application has to be modified to use a non-hyphen property.
    – Leviani
    Oct 25, 2018 at 12:57
  • 1
    I tried about a dozen different replacement and none worked. Oct 26, 2018 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.