Hi i have a content search webpart when a user does not have a profile-image on that persons site, it display a default image like this how could i be able to change default image that is rendered? i would like to use the image that is rendered on mysite thats a sharepoint default image if user does not have an image?

enter image description here

I want to use this image

var authorImage = ms_outHtml.push(' ',' <img class="authorImage" src="/_layouts/15/userphoto.aspx?size=S&accountname=', ctx.CurrentItem.Author , '" />');

How could i set this for default image if user dont have uploaded image?


Copy the out of the box Display Template, rename it and upload it back to SharePoint. Edit the Display Template to point to your desired image. There are many answers to this process here in SE as well as blog posts on the topic. You just have to create a new Display Template.


Copy the existing display template:

After this, open your copied file and check whether uPicUrl is empty. If yes, provide it with your default URL.

Now, you have to create new Result type. Go to Site settings -> Search -> Result types. Find 'Person' and duplicate it. Go to this duplicated result type and change the display template to one you have created. http://your-server/_layouts/15/ManageResultTypes.aspx?level=sitecol

Now you should be able to see users with new picture.

Be careful, result types can be defined on site or site collection level. Depends, where you want to use the search. I am using central search so site level is ok for me.

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.