0

I have to display all SharePoint Online user's profile information including profile picture on a page in SharePoint Online.

Here profile pictures are added in Azure Active Directory.

As mentioned here, PictureUrl property does not synchronize with Azure Active Directory.

But, When I open up the delv of user, the profile picture shown there, but when I try to fetch the user profile using REST API, PictureUrl propery is always null?

Delve:-

enter image description here

PictureUrl Property:

enter image description here

Any reason behind this?

I already posted this here but it was all about using Graph API. Now my question is regarding PictureUrl property.

3
  • 1
    I think that's because the pictures are fetched from elsewhere. Answer in this question should work at least with my Delve setup's case.
    – moe
    May 24 '17 at 5:13
  • I am using that only. But it returns default thumbnail everytime. it seems that it does not generate the thumbnail image. If this is the case then the main question is from where its displaying on Delve? If I check image source then it always shows up the same for every image, whether that image is added in Azure AD or Office 365 user profile. May 24 '17 at 5:16
  • My bad, can you check with this url - https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=user@tenant.onmicrosoft.com&size=HR120x120 ? May 24 '17 at 5:35
1

Gautam Sheth's answer works perfeclty. https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email=joe.shmoe@ms.com&size=HR120x120 This always gets profile photo, even if synch fails between Delve (OWA) and UserInfo Table within SP site. The only thing is, when user does not have a photo in Delve (OWA) it returns an blank picture. We can attach to the load event for the pic then and detect it like so:

On Load event for html generated IMG:

onload='OnEmptyPic(this)'

function OnEmptyPic(theImg)
{
    var img = new Image();
    var newSrc = theImg.src;
    img.onload = function(){
        if(this.width == 1)
        {
            newSrc = '.../images/person.gif';
            theImg.src = newSrc;
        }   
    };
    img.src = newSrc;
}

If image returned from Delve has a width of 1, we just replace it with some other, generic one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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