QUERCUS BLOG
Industry Insights from Our Experts

While creating a SharePoint Search Result display template to display a user’s profile information I needed to configure a large list of managed property values inside the ManagedPropertyMapping tags. The list became very large so I thought I would add some line breaks to group the properties into the same groupings that they are displayed in the HTML.

<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path',
'Description':'Description','EditorOWSUSER':'EditorOWSUSER',
'LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus',
'DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary',
'HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension',
'ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType',
'IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension',
'DisplayAuthor':'DisplayAuthor',

'MeCrmContactId':'MeCrmContactId','MeCrmPrefix':'MeCrmPrefix',
'MeCrmFirstName':'MeCrmFirstName','MeCrmMiddleName':'MeCrmMiddleName',
'MeCrmLastName':'MeCrmLastName','MeCrmGenderCode':'MeCrmGenderCode',
'MeCrmBirthDate':'MeCrmBirthDate','MeCrmDeceased':'MeCrmDeceased',

'MeCrmMeStatus':'MeCrmMeStatus',
'MeCrmMeCertificationPrefix':'MeCrmMeCertificationPrefix','MeCrmMeNumber':'MeCrmMeNumber',
'MeCrmMeFirstIssueDate':'MeCrmMeFirstIssueDate',
'MeCrmMeExpiryDate':'MeCrmMeExpiryDate',
'MeCrmLastCertExpiryNotice':'MeCrmLastCertExpiryNotice',

'MeCrmPrefAddressType':'MeCrmPrefAddressType',
'MeCrmPrefAddrLine1':'MeCrmPrefAddrLine1','MeCrmPrefAddrLine2':'MeCrmPrefAddrLine2',
'MeCrmPrefAddrCity':'MeCrmPrefAddrCity',
'MeCrmPrefAddrProvince':'MeCrmPrefAddrProvince',
'MeCrmPrefAddrPostalCode':'MeCrmPrefAddrPostalCode',
'MeCrmPrefAddrTelephone':'MeCrmPrefAddrTelephone','MeCrmPrefAddrFax':'MeCrmPrefAddrFax',

'MeCrmAddressType':'MeCrmAddressType','MeCrmAddrLine1':'MeCrmAddrLine1',
'MeCrmAddrLine2':'MeCrmAddrLine2','MeCrmAddrCity':'MeCrmAddrCity',
'MeCrmAddrProvince':'MeCrmAddrProvince','MeCrmAddrPostalCode':'MeCrmAddrPostalCode',
'MeCrmAddrTelephone':'MeCrmAddrTelephone','MeCrmAddrFax':'MeCrmAddrFax',

'MeCrmHomePhone':'MeCrmHomePhone','MeCrmMobilePhone':'MeCrmMobilePhone',
'MeCrmBusinessPhone':'MeCrmBusinessPhone','MeCrmFax':'MeCrmFax',
'MeCrmEmail':'MeCrmEmail'</mso:ManagedPropertyMapping>

This made it easier to work with the template file so I uploaded the template to SharePoint and displayed the page that used the template and most of data fields were blank. What’s up SharePoint?

I removed the line breaks from the managed property list reverting it back to one long list of values.

<mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path',
'Description':'Description','EditorOWSUSER':'EditorOWSUSER',
'LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus',
'DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary',
'HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension',
'ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType',
'IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension',
'DisplayAuthor':'DisplayAuthor','MeCrmContactId':'MeCrmContactId',
'MeCrmPrefix':'MeCrmPrefix','MeCrmFirstName':'MeCrmFirstName',
'MeCrmMiddleName':'MeCrmMiddleName','MeCrmLastName':'MeCrmLastName',
'MeCrmGenderCode':'MeCrmGenderCode','MeCrmBirthDate':'MeCrmBirthDate',
'MeCrmDeceased':'MeCrmDeceased','MeCrmMeStatus':'MeCrmMeStatus',
'MeCrmMeCertificationPrefix':'MeCrmMeCertificationPrefix','MeCrmMeNumber':'MeCrmMeNumber',
'MeCrmMeFirstIssueDate':'MeCrmMeFirstIssueDate','MeCrmMeExpiryDate':'MeCrmMeExpiryDate',
'MeCrmLastCertExpiryNotice':'MeCrmLastCertExpiryNotice',
'MeCrmPrefAddressType':'MeCrmPrefAddressType','MeCrmPrefAddrLine1':'MeCrmPrefAddrLine1',
'MeCrmPrefAddrLine2':'MeCrmPrefAddrLine2','MeCrmPrefAddrCity':'MeCrmPrefAddrCity',
'MeCrmPrefAddrProvince':'MeCrmPrefAddrProvince',
'MeCrmPrefAddrPostalCode':'MeCrmPrefAddrPostalCode',
'MeCrmPrefAddrTelephone':'MeCrmPrefAddrTelephone','MeCrmPrefAddrFax':'MeCrmPrefAddrFax',
'MeCrmAddressType':'MeCrmAddressType','MeCrmAddrLine1':'MeCrmAddrLine1',
'MeCrmAddrLine2':'MeCrmAddrLine2','MeCrmAddrCity':'MeCrmAddrCity',
'MeCrmAddrProvince':'MeCrmAddrProvince','MeCrmAddrPostalCode':'MeCrmAddrPostalCode',
'MeCrmAddrTelephone':'MeCrmAddrTelephone','MeCrmAddrFax':'MeCrmAddrFax',
'MeCrmHomePhone':'MeCrmHomePhone','MeCrmMobilePhone':'MeCrmMobilePhone',
'MeCrmBusinessPhone':'MeCrmBusinessPhone','MeCrmFax':'MeCrmFax','MeCrmEmail':'MeCrmEmail'
</mso:ManagedPropertyMapping>

I re-uploaded the template to SharePoint and reloaded the page using the template. The data fields now displayed the proper values in the SharePoint page. It would seem that SharePoint will not ignore line breaks in display template XML and turning on “Word Wrap” in my editor is a better solution.

Happy SharePointing!

 

 

 

Copyright 2017 by Quercus Solutions
Login