SharePoint : Broken user picture – SP or PH Add-ins

In any hosted add-ins if you want to get & display user picture, the image Url would be something like this from the user properties.

"https://{mydrivedomain}/User%20Photos/Profile%20Pictures/ridhvi_MThumb.jpg”

Referencing the same Url to an image element will results in as broken image due to cross domain authentication issue while downloading the picture.

Work around for this would be

Construct the Url using “userphoto.aspx” as mentioned below which will download you the picture in different sizes like M or L.

https://{SPurl}/_layouts/15/userphoto.aspx?size=L&[email protected]

Happy Learning !!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.