Today I’m gonna share with you a simple tip, which is used on SharePoint online. I just roaming on files today in SharePoint online site to check what are the files and resources are used by it.

There I have saw a service URL, which looks different and it returns the current user image without using any code. The below URL returns my profile image which I updated in Office 365,

https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=ktskumar@SharePointsite.onmicrosoft.com&UA=0&size=HR64x64&sc=1468233338850

To get the user image from Office 365, we have to pass the users’s email id with the service url.

https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=<User's work email account>&UA=0&size=HR<Size>

Query strings:
email, UA, size, sc

We can receive the image in different sizes, For me HR32x32 and HR64x64 worked.

If you provided the unsupported size in the url returns the below error message,

{"Body":{"ErrorCode":500,"ExceptionName":"ArgumentException","FaultMessage":"Requested value 'HR128x128' was not found.","IsTransient":false}}
Get User Image from Office 365
Tagged on:         

4 thoughts on “Get User Image from Office 365

  • July 13, 2016 at 11:48 AM
    Permalink

    Hello,

    What if, image is not there in Outlook/Office 365. What this URL will return ?
    In my case, its not returning anything when I am putting this on browser.

    Reply
    • July 13, 2016 at 6:16 PM
      Permalink

      If there is no image available for the user, this returns empty image reference.

      Actually, the image is stored on that URL.
      If the user not upload any image for the profile image, user will get empty image reference.

      Reply
  • September 14, 2016 at 4:26 AM
    Permalink

    How would you get the current user using the same url?

    Reply
  • June 23, 2018 at 1:57 AM
    Permalink

    I added this code to page with a number of users in a list. It picked up the images perfectly for me but when I had a coworker try to go to the same page all they got was empty image boxes. Is there a credential issue for using this???

    Reply

Leave a Reply

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