Shantha Kumar T
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}}
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.
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.
How would you get the current user using the same url?
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???
I am having the same issue as Adam. Any thoughts?
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.
You must be logged in to see the images. Otherwise the server will return an 401 status code and an 1x1px image.
Also in my case the URL has changed to https://outlook.office.com/owa/service.svc/s/GetPersonaPhoto
What does UA and sc query strings mean?