8 thoughts on “Displaying User Profile Picture in Apps

  1. Pingback: User profile picture in SP hosted app | My SharePoint Learnings

  2. There is no needs to test the size of the profile picture. Just use another default image at the same position as the profile picture. When the profile picture doesn’t load for any reason, the default image will show. Otherwise the profile image will cover the default image. That is whole point why the service return 1 pixel image when there is profile picture.

  3. I’m assuming that userphoto is used for hosted SharePoint and getpersonalphoto for O365, for add-ins? However not sure if it’s a bug but in add-ins but userphoto tries to get photo from https://hostweb-{appid}.sharepoint.com/_layouts/15/userphoto.aspx which doesn’t exist with the {appid} included and throws a 500 error. Thoughts?

  4. Garima, I’ve built a very similar app which retrieves a users photo (from SP user profile), their name and job title. I’ve also added a link to change the user photo, via https://portal.office.com/userphoto.

    I’m finding the original picture that loads gets cached in the browser (IE, Edge and Chrome), after the user changes their picture at the above URL.

    It doesn’t matter if I change my app to retrieve the photo from Delve or Outlook, the caching still occurs. In fact, the profile picture in the top right hand corner of SharePoint Online (pulled from Delve) actually changes, leaving the app user profile picture cached.

    Have you ever experienced this? Any chance you know a way around this issue?

    • Hi Steve, are you facing the same issue with both methods? Could you try and append a query string parameter to the URL so that the generated image is not cached? It is one way around this issue.

  5. https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/sizerequested
    Value Meaning
    HR48x48 The image is 48 pixels high and 48 pixels wide.
    HR64x64 The image is 64 pixels high and 64 pixels wide.
    HR96x96 The image is 96 pixels high and 96 pixels wide.
    HR120x120 The image is 120 pixels high and 120 pixels wide.
    HR240x240 The image is 240 pixels high and 240 pixels wide.
    HR360x360 The image is 360 pixels high and 360 pixels wide.
    HR432x432 The image is 432 pixels high and 432 pixels wide.
    HR504x504 The image is 504 pixels high and 504 pixels wide.
    HR648x648 The image is 648 pixels high and 648 pixels wide.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s