User Photos missing in SharePoint from On-prem Synced Accounts

Problem Description

If you are in a hybrid environment where users are synced from on-prem AD to Azure AD using AD Connect, you may find that your user photos were never populated in SharePoint Online. In this case, the user photo may be displayed in Outlook (OWA), and Teams but not SharePoint.

Here is an example:

Outlook:

Teams:

SharePoint

Cause

This issue is occurring because there is currently a 10 KB limit for UserPhotos to be stored in Exchange Online. In many cases, the userPhotos are populated by updating the “thumbnailPhoto” attribute in Active Directory.

The thumbnailPhoto attribute from the on-prem AD is synchronizationed AzureAD, but never pulled into Exchange due to the 10 KB limitation.

Since SharePoint Online only pulls from Exchange Online to populate the user photo, if the photo is missing in Exchange Online, it will never be displayed in SharePoint Online.

You can determine if this issue occurring in your environment by inspecting your Exchange Online mailboxes to see of the user attribute “HasPicture” equals false.

Example:

get-mailbox -ResultSize Unlimited | Where {($_.IsDirSynced -eq $true -and $_.HasPicture -eq $false)}

Solution

To resolve this issue, you can use this script to execute the following actions.

Part 1:

Find all users that are missing photos in Exchange Online and update the photo from AzureAD.

1. Loop through all users, locate the photo in Azure AD

2. Download the photo to a temp location on the PC.

3. Publish the photo in Exchange Online

4. Delete the downloaded photos.

Part 2:

Copy the photos from Exchange Online to SharePoint.

1. Loop through all users that have photos in Exchange Online.

2. Locate their photo in Exchange Online.

3. Publish the photos from Exchange Online to SharePoint Online.

4. Update the SharePoint User Properties to reflect the new user photo.

Please Note: Part 2 is only required if you want the photo to show up right away in SharePoint Online. The photo will eventually make its way to SharePoint Online within 3 days via backend timer jobs.

The Script

What the script looks like in action:

Here is an example of running “Part 1” the script for a single user.

Now you can see that “JSMITH” no longer shows up in the query to show “HasPicture = False

Now the user photo has been updated in Exchange Online, but it still missing in SharePoint, until you wait for the UPA to sync via backend timer jobs.

If you want to update the photo in SharePoint right away, run “Part 2” of the script:

Now when sharing content via SharePoint, the UserPhoto will be displayed.

Conclusion

I hope you found this information useful, and provided a better understanding of why this issue is occurring and how to resolve it. If you have any comments, please let me know.

More Information

User photos aren’t synced to Exchange Online – Exchange | Microsoft Learn

Information about profile picture synchronization in Microsoft 365 – Microsoft Support

Add your profile photo to Microsoft 365 – Microsoft Support

Leave a Reply