I'm currently making a display template for my content search query. I would like to show the attachments but I don't know what code I would use to do this. Here is my code but I don't have anything for showing attachments can anyone help?

    var encodedId = $htmlEncode(ctx.ClientControl.get_nextUniqueId() + "_2lines_");

    var linkURL = $getItemValue(ctx, "Link URL");
    var iconURL = Srch.ContentBySearch.getIconSourceFromItem(ctx.CurrentItem);

    var line1 = $getItemValue(ctx, "Line 1");
    var line2 = $getItemValue(ctx, "Line 2");

    var pictureURL = $getItemValue(ctx, "Picture URL");
    var pictureId = encodedId + "picture";
    var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 304, 100, ctx.CurrentItem, "cbs-pictureOnTopImg", line1, pictureId);

    var containerId = encodedId + "container";
    var pictureLinkId = encodedId + "pictureLink";
    var pictureId = encodedId + "picture";
    var pictureContainerId = encodedId + "pictureContainer";
    var dataContainerId = encodedId + "dataContainer";
    var line1LinkId = encodedId + "line1Link";
    var line1Id = encodedId + "line1";
    var line2Id = encodedId + "line2";
  <div class="news-item">
     <div class="cbs-pictureOnTopImageContainer" id="_#= pictureContainerId =#_">
            <a class="cbs-pictureImgLink" href="_#= linkURL =#_" title="_#= $htmlEncode(line1) =#_" id="_#= pictureLinkId =#_">
                _#= pictureMarkup =#_
      <img src="http://placehold.it/469x300">
        <h2>_#= line1 =#_</h2>
        <p>Item Paragraph</p>
        <a class="cbs-Line1Link" href="_#= linkURL =#_" title="_#= $htmlEncode(line1.defaultValueRenderer(line1)) =#_" id="_#= line1LinkId =#_"><span>More</span></a>           

There is a managed metadata property called LinkOfficeChild that contains the attachments of an item.

You can check at http://techmikael.blogspot.ch/2014/04/solution-to-displaying-attachments-for.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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