Set-UserPhoto size of picture?

Copper Contributor

Hi Community!

 

I've been trying to read up on the subject regarding user thumbnail photos in Office365 but I'd like to hear the "final" version from Microsoft about this.

 

I have a customer that wants to upload images that are bigger in size than what AD on-premise support(100kb) and Azure AD support(10kb)

 

From what I've heard Exchange Online can be the one holding the profile pic of up to 500 kb and 648x648 resolution

 

So I'm trying this out like this:

New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxyMethod=RPS

 

Set-UserPhoto -Identity $user -PictureData ([System.IO.File]::ReadAllBytes($userphoto)) -Confirm:$false

 

I'm using a picture larger than 500kb and higher resolution than 648x648 (to try if it gets cropped and reduced in size by Office 365) and it accepts it. All is fine.

 

But then I fetch the photo:

$user = Get-UserPhoto user@domain.com
$user.PictureData |Set-Content "C:\$($user.Identity).jpg" -Encoding byte

 

And the photo has a resolution that's 240x240 and filesize 8kb

 

Why is it like that, am I doing something wrong?

 

/Daniel

7 Replies

When we upload larger picture, Exchange can automatically resize these photos for use in different products as needed. I haven't found the official recommendation for the particular size, but as mentioned in the below Technet article, it can can automatically resize in three different photo sizes and resolutions:

 

  • 64 pixels by 64 pixels, the size used for the Active Directory thumbnailPhoto attribute. If you upload a photo to Exchange Server, Exchange will automatically create a 64 pixel by 64 pixel version of that photo and update the user's thumbnailPhoto attribute. Note, however, that the reverse is not true: if you manually update the thumbnailPhoto attribute in Active Directory the photo in the user's Exchange mailbox will not automatically be updated.

  • 96 pixels by 96 pixels, for use in Microsoft Outlook 2013 Web App, Microsoft Outlook 2013, Skype for Business Web App, and Skype for Business.

  • 648 pixels by 648 pixels for use in Skype for Business and Skype for Business Web App Skype for Business Web App.

Article- https://technet.microsoft.com/en-us/library/jj688150.aspx

 

Thank you Vishal,

 

The article doesn't mention 240x240 as a resolution being used anywhere, then it seems strange that it's the resolution you get when fetching from Exchange online and the filesize is approximately 7kb.

 

So, if you don't make use of Skype then I see no real improvement of using Set-UserPhoto and the manual labour of using powershell scripts. Then we can just go with the ADsync of the thumbnail attribute resulting in 10 kb images, which is what you get anyway?

 

Or am I missing something?

 

/Daniel

I believe thats true. If we have to use for S4B or any other service where it required higher resolution, it will help.

Photos in O365 are still a mess, but in general what Vishal said is true. The available sizes for Exchange are listed here: https://msdn.microsoft.com/en-us/library/office/jj191419(v=exchg.150).aspx

 

You can get a soecific size via:

https://outlook.office365.com/ews/Exchange.asmx/s/GetUserPhoto?email=user@domain.com&size=HR240x240

 

Which is not guarantee that you will have the same sizes in other workloads. You can see (most) available sizes from SPO's MySites store: https://tenant-my.sharepoint.com/User%20Photos/Forms/Thumbnails.aspx?id=%2FUser%20Photos%2FProfile%2...

 

 

Thanks Vasil for confirming my experience that photos are a mess in O365.

 

I will soon receive feedback from the customer regarding the resolution and quality of the photos that I uploaded through powershell and try to explain all the ifs and buts and caveats of photos in O365.

I disagree with the statement that photos are a mess, they work as expected. The issue the original author has is not in the photos, but in a limitation of the Get-UserPhoto powershell command.

 

As you may note, there is no switch with the command to specify the photo size to retrieve, so the command is simply always retrieving the HR240x240 value.

 

If you examine the photos available through the Web UI for Outlook, such as:

https://outlook.office365.com/ews/Exchange.asmx/s/GetUserPhoto?email=user@domain.com&size=HR648x648

 

You will note that all sizes of HR listed here should be retrievable by changing the HR value:

https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/sizerequested

 

So to summarize as a Best Practices Recommendation:

  1. Avoid using Active Directory ThumbnailPhotos as a means of replicating photos from on prem to Office 365 as the photo resolution is no greater than 64x64 and the file size is restricted to 10KB.
  2. For users with an Exchange Online or Skype for Business Online licensing, profile photos should be cropped or resized to 648x648 prior to uploading to Office 365 to ensure proper aspect ratios are maintained when Exchange Online automatically resizes the photos.
  3. Administrators may upload prepared profile photos for their users with Exchange Online or Skype for Business Online using the Set-UserPhoto command.
  4. For more restrictive environments, disable the user's ability to modify their profile photo. This can be accomplished with a command: Get-OwaMailboxPolicy | Set-OwaMailboxPolicy -SetPhotoEnabled $false
    This process takes an hour or more to complete.
  5. These profile photos will be copied automatically into SharePoint Online for the small, medium, and large photos it stores.
    This process is not immediate in some cases, may require up to 72 hours to update.
  6. For users with only SharePoint Online licensing, and no Exchange or Skype, the profile photo will only be stored in SharePoint Online and the previous commands to set the photo are not available to the Administrator.
    Most Office 365 deployments include Exchange Online, so this is a limited scenario.