Get User Image from Office 365

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}}

3 thoughts on “Get User Image from Office 365

  1. Vipul Jain Reply

    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.

    • Shantha Kumar Post authorReply

      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.

Leave a Reply

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