I'm using SharePoint Online and I'm trying to retrieve user photo making a request to userphoto.aspx with this URL:

var account = encodeURI([email protected]);
return "https://mysharepoint.sharepoint.com/_layouts/15/userphoto.aspx?size=L&accountname="+account;

For some users this is working fine and I see the image correctly, for others it keeps returning the image like it is missing (but I checked and user added its own user photo).

The user who I am checking has never opened the company SharePoint site.

Any idea?

2 Answers 2


You may have better luck using the Graph for this. Create a REST request in the contaxt of the user. https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0


or if it's for another user

/users/{id | userPrincipalName}/photo/$value

Test if images are present in SharePoint by using the below urls:

https://my-site-url/User Photos/Profile Pictures/david_contoso_onmicrosoft_com_MThumb.jpg

https://xxx.sharepoint.com/sites/dev/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='PictureURL')?@v='i:0%23.f|membership|[email protected]'

If still it does not return any pictur url, then I guess your sync between Exchange Online-SharePoint Online is broken. Check this article information on the sync.

  • 1
    Thank you. It seems if the user doesn't not open SharePoint Online, the photo still remains unavailable. Do you know if there's a way to force sync without force user to log in to SharePoint?
    – Pepozzo
    Commented Oct 7, 2019 at 13:11
  • That is related to User Information List. And entry of the user is made only when user first time visits the site. Commented Oct 7, 2019 at 14:25
  • I've opened SharePoint Online with another user (that has set its photo and I can see that photo on top right corner). I've waited about 24 hours but photo is still not available with Userphoto.aspx
    – Pepozzo
    Commented Oct 8, 2019 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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