Importing Thumbnail Photos from AD(Active Directory) into SharePoint 2010

 

 

Problem

Lately I have seen several people having difficulties in importing thumbnail Photos from Active Directory. In this post I would be explaining the step by step process of importing  thumbnail Photos

PreReq

I am assuming that you have a working User Profile Service application and MySites configured. You should be successfully able to import users

Setup

I have OU called “PictureOU” inside my domain “Contoso.com”

I have a single user called “Harmeet”

image

At present there is no picture associated to this user inside Active Directory.

image

Note- You will not see all the user attributes if you have not turned on the “Advanced Features”. You can also view the same information from ADSI.

How to import Pictures

Now our Goal is to import Harmeet profile along with his picture, we will also upload his picture in AD.

1) First we need to make sure we are able to import users. So I will create connection to OU – PictureOU and import users

image

Note- I am only importing users from OU PictureOU

2) Let’s check Harmeet’s profile in SharePoint and make sure there is no picture associated to it.

image

 

Picture for this user is set to be blank

3) Upload Pictures to Active Directory.

Lots of people also have trouble in finding out ways to upload pictures in Active Directory. Following are the two best methods that I am aware off

A. Run these commands in Windows Powershell. We need to have Windows Administrative tools loaded for this to work

Import-Module ActiveDirectory

$photo=[byte[]](Get-Content C:\harmeet.jpg -Encoding byte)

Set-ADUser "harmeet" -Replace @{thumbnailPhoto=$photo}

B. We can use AD Photo Edit tool available at https://www.cjwdev.co.uk/Software/ADPhotoEdit/Info.html . Please note that this is not a Microsoft supported tool

Note- By default users do have permission to change their own picture, if you are doing it for a different user then make sure you have required Permissions on Active Directory

4) Let’s check User properties in Active Directory and make sure if has Picture value set

image

 

5) Map the Picture property to Thumnail Photo

A) Browse to User Profile Service Application from Central Administratoion and then click on Manage User Properties

Central Administration > UPA > Manage User Properties

B)  Click on Picture and then Edit

image

C) We need to Map this to Attribute “thumnailPhoto” and Select Import from the Direction. Make sure you click on on Add

image

D) After clicking on Add make sure it shows up under the “Property Mapping for Synchronization”section

image

E) Click on OK

6) Start incremental Import

7) Let’s check the User properties and see if the image has been populated

image

So Picture still showing blank

8) Let’s check MIIS client and see if it made an attempt to import the picture. For this we will need to DS_DELTASYNC

image

So it does appear that FIM picked up the image successfully from Active Directory

9) Let’s check the Sync DB by running the following query

Select sAMAccountName,SPS_MV_OctetString_PictureURL from MMS_Metaverse with(nolock) Where SAMAccountName like '%UserName%'

image

So it appears Sync DB has successfully got updated with the Image.

 

10) Now let’s check the Profile DB by running the following query

Select NTname,PictureURL from UserProfile_full with(nolock) where NTName like ‘%harmeet%’

image

So it appears that Picture has not made it to the Profile DB

11) Run the following in SharePoint Management Shell
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation https://mysite

https://support.microsoft.com/kb/2394320

12) Now if you go back to the user profile you will see that the image has been updated

image

 

Troubleshooting:

How to find if an image for a user has been imported in Sync DB

Select sAMAccountName,SPS_MV_OctetString_PictureURL from MMS_Metaverse  with(nolock) Where SAMAccountName like '%UserName%'

How to find if an image for a user has been imported in Profile DB

Select NTname,PictureURL from UserProfile_full with(nolock) where NTName like ‘%UserName%’

We first import images from AD into Sync DB and then populate it into the Profile DB. By default images do not auto populate in Profile DB,we need to run the following CMDlet

Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation https://mysite

Image type issues

Best way to troubleshoot this issue is by creating a simple JPG file from MSPaint and then upload it to the Active Directory, if this comes through then you will need to check out the file types or the size issues.

Comments

  • Anonymous
    January 01, 2003
    @Moi -  What patch are you running on? support.microsoft.com/.../2394320

  • Anonymous
    January 01, 2003
    @Hrishi. I was also at the Oct 2011 CU and i had to apply the December 2011 CU to get that command to work

  • Anonymous
    January 01, 2003
    Nice write-up! helped me a lot. worked like a charm

  • Anonymous
    January 01, 2003
    @Harshi - Do you know at what stage are you failling? Do you see the picture being imported in MIIS client?

  • Anonymous
    September 25, 2011
    Thanks Harmeet, helped alot!

  • Anonymous
    November 30, 2011
    Thanks, but the Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://mysite don(t work for us. What version have you to have -CreateThumbnailsForImportedPhotos ? It doesn't exist in documentation .... 3 days we are looking through that prob

  • Anonymous
    January 09, 2012
    Thanks for the step by step article. I have Oct 2011 CU and still facing the issue. Executing above command did not help Thanks, Hrishi

  • Anonymous
    June 01, 2012
    The comment has been removed

  • Anonymous
    September 06, 2012
    Worked, however, in the newsfeed there are no pictures.

  • Anonymous
    November 03, 2013
    Hey, What does it mean to have no import option at all from AD from step 5-D? Please help :( Vivek

  • Anonymous
    January 21, 2014
    Harmeet,I have the same issue, MySite is pulling the Pictures right but People search doesn't. Please help.

  • Anonymous
    September 30, 2014
    Thanks Harmeet Good Article explained step by step

  • Anonymous
    November 26, 2014
    Works awesome. We also use this PS command. 'Update-SPProfilePhotoStore -MySiteHostLocation http:/// -CreateThumbnailsForImportedPhotos 1'