Quantcast
Channel: James Brennan's Blog » My Sites
Viewing all articles
Browse latest Browse all 2

User Photo’s Stored In Active Directory Can Not Be Displayed

$
0
0

A client was recently attempting to sync their user photo’s stored within AD with the user profiles service in SharePoint 2010. When ever they tried to view the photo’s in the various locations in SharePoint they would see a red cross:

When they performed a sync and ran the update-spprofilephotostore PowerShell command, they could see the preview for the SThumb, MThumb, and LThumb thumbnails. However when trying to access either the MThumb or LThumb image, they would again see the red cross instead of the user photo.

Between running the full sync and running the update-spprofilephotostore command, the user photo’s are stored within the User Photos picture library with GUID names:

When I clicked on one of these images to view the image directly again I would receive a red cross. This rules out the update-spprofilephotostore command as the culprit.

Using the following PowerShell commands (found on Mike Pfeiffer’s blog), you can save a copy of the image to the thumbnailphoto attribute in Active Directory for a given user:

$user = Get-ADUser  -Properties thumbnailphoto
$user.thumbnailphoto | Set-Content c:\.jpg -Encoding byte

When I tried to open the resulting .jpg in Internet Explorer I would get the familiar red cross. Use the second piece of code on Mike’s blog to save a photo to the thumbnailphoto attribute and then repeat the download process to a new file to verify the image correctly displays in Internet Explorer. The cause of the red cross issue appears to be the tool the client was using to save the various user photo’s to Active Directory.

To save an image to the thumbnailphoto attribute in Active Directory use the following PowerShell command:

$photo = [byte[]](Get-Content C:\john.jpg -Encoding byte)
Set-ADUser john -Replace @{thumbnailPhoto=$photo}

I have been able to prove this theory by saving two separate user photo’s to Active Directory and importing them into SharePoint using a full sync. The user photo saved to Active Directory with the dedicated application would display a red cross and the photo saved to Active Directory with PowerShell would display correctly.

It appears that the free application dedicated to saving user photo’s to Active Directory for use in Outlook and Exchange doesn’t quite save the image in a format that Internet Explorer can handle correctly.

It is worth mentioning that the Microsoft SharePoint Social Computing Team Blog has some great information regarding SharePoint 2010 and how it utilises user photo’s.



Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images