User Photo in Office 365 it’s a problem that was driving me crazy for the last few weeks, even I wrote a lot of posts on the official Microsoft forum. This one is based on personal experience of the last few weeks when I was doing our local Active Directory integration with Office 365 and Azure AD. I am SharePoint guy and I just wanted to present my users photos in SharePoint. Unfortunately for some reasons user photos which were existing in my local active directory on-premise installation didn’t appear in SharePoint online. Our local support says that everything is perfect. Unfortunately, there was a problem.

This is my account in our on-premise AD

My AD Photo
My AD Photo

But when I displayed my user in Office 365 there was no my photo

my Office 365 Photo
my Office 365 Photo


So what’s the problem with User Photo in Office 365?

Well, in the case of user photo synchronization between on-premise Active Directory and Office 365 we have considered a few things:

  • user photos from local AD will not appear in all application of Office 365 in the same time!
  • first place where user photo appears is Exchange online
  • To present user photo from local AD photo size must be less than 10KB
  • If there’s no user photo in Exchange online it will not appear in SharePoint online too…
  • If we have photo in Exchane online we have to start sync process to SharePoint online


How to force sync process to SharePoint online

Everything seems to be simple but sometimes it doesn’t work as it should. Even as tenant administrators we can’t start synchronization in the Office 365 interface of user photo to SharePoint online.

To start the synchronization process each user should go to my sites or Delve. Also, user can do the following steps:

About me > press photo  > Change photos > we are changing photos in Edit Details >

Usually, it works. If we have a problem we can try the following steps to get User Photo in Office 365:

  1. Go to SharePoint Online Admin Center in Office 365 admin portal> User profiles
  2. In People we select ‘Manage User Profiles’
  3. We are looking for the user who has a problem
  4. Let’s edit user profile and search for Picture Exchange Sync State
  5. Picture Exchange Sync State – change to 0, delete photo and save
  6. Picture Exchange Sync State – change to 1, save and check the result

It’s worth remembering which has a very important impact on our solution. According to Technet thumbnailPhoto property is synchronized between Azure AD and Exchange Online only one time! All later changes in our on-premise AD will not be sent to  Exchange Online.

Well, we still can use PowerShell

Connect to Exchange online:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

We can change user photo with following command (base on Technet):

Set-UserPhoto "Paul Cannon" -PictureData ([System.IO.File]::ReadAllBytes("C:\Users\Administrator\Desktop\PaulCannon.jpg"))

Unfortunately this option described on Technet site in not accurate. If you get an error just like below you have to update your script

Error on proxy command ‘Set-UserPhoto -PictureData: …
‘False’ to server Server version 15.01.0390.0000, Proxy method PSWS:
Request return error with following error message:
The remote server returned an error: (413) Request Entity Too Large…
+ CategoryInfo          : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException
+ FullyQualifiedErrorId : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.RecipientTasks.SetUserPhoto
+ PSComputerName        :

In our script, we have to update the parameter -ConnectionUri. As you can see I added the option ?proxyMethod=RPS  . Also before we can use our photo we should encode it into variables.

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber -WarningAction SilentlyContinue -ErrorAction SilentlyContinue
$user1 = ([Byte[]] $(Get-Content -Path C:\1\Tomek1.jpg -Encoding Byte -ReadCount 0))
set-userphoto -identity [email protected] -picturedata $user1
Remove-PSSession $Session

And that’s all. I hope that this short post will help you to solve problems with user Photo in Office 365 during local Active Directory and Office 365