I want to add a person column with person's name and image in search result webpart. I create a item display template and add this property "Team Member" to this custom template.

enter image description here

But the results cannot display name with person's image. It always show

name@domain.com | NAME | 693A30232E777C736172657465635C6A706D61737369636F74 i:0#.w|DOMAIN\NAME

How could I change this to person's name and image ?

Thank you all !


I found a solution, a litte stupid but it works I add javascript to get user's photo from mysite

<div id="UserOWSUSER" class="ms-peopleux-userImgDiv">Nom : _#= ctx.CurrentItem.UserOWSUSER=#_</div>
            <!--#_  var UserData = ctx.CurrentItem.UserOWSUSER;
                    var UserNumber = UserData.indexOf("@");
                    var ResName = UserData.substr(0,UserNumber);
                    var UserPhotoUrl = "http://mysite.domain:80/User Photos/Images of profil/"+ResName+"_MThumb.jpg"; _#-->
        <div><img id="PIC" style="clip: rect(0px, 72px, 72px, 0px); min-height: 72px; min-width: 72px; max-width: 72px;" src="_#= UserPhotoUrl =#_"></div>
  • You should handle the case that the person does not have a picture. May 19 '15 at 16:22
  • @MaxMelcher yes, I add JavaScript to check if the picture exist. If the person does not have a picture, it displays image blank by default. (the image with grey background colour)
    – AnnaCICI
    May 19 '15 at 17:20

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.