How to Import pictures from AD to UPA – SharePoint 2010
Updated: Apr 11
You should apply the October 2010 CU or a later one as appropriate
Restart the User Profile Synchronization service (ie stop and start)
Edit the picture property (_layouts/editproperty.aspx) in the UPA. Add a property mapping that imports the thumbNailPhoto attribute from AD.
This should cause a thumbnailPhoto checkbox to show up on the “Select Attributes” page of the Active Directory MA (as viewed through the FIM client)
Kick off a full profile sync from Central Admin
TIP: It might help to edit the sync connection to import an OU with only a few users for verification purposes. Or maybe create a new sync connection.
After sync completes, in the FIM client, find the DS_FullSync (this is what reads data from AD) run associated with the full sync that just completed. Click the Adds link, find a test user, click it…look to see if the thumbnailphoto attribute shows data.
Next look for the MOSS_Export run (this is what writes data to SharePoint), similarly, look for your test user and see if pictureURL has data under the New Value column.
The step above will create a picture for each user in the User Photos picture library under the mySite host…eg http://mySiteHostURL/User%20Photos/Forms/AllItems.aspx. The unprocessed pics will be named with GUIDs.
If you don’t see the pics that you expect…then there might be a problem with the format of the data stored in AD. Look in the ULS logs for exceptions. One exception I ran into was…this was because the thumbNailPhoto attribute contained base64 data and we can’t use that:
SavePictureToLibrary: Error processing the photo URL 0c37852b-34d0-418e-91c6-2ac25af4be5b_3.jpg for user 3: System.ARgumentException: Parameter is not valid.
at System.Drawing.Bitmap..ctor(Stream stream, Boolean user|cm)
at Microsoft.Office.Server.UserProfiles.UserProfileGlobal.SaveImportedPictureToLibrary(UserProfileManager userProfileManager, Int64 recordId, Byte binaryPicture)
To verify the data format, download AD Photo Edit from cjwdev.co.uk…and use it to import a picture for a user. This tool stores data in the right format. You’ll need to start from step 5 again.
If a picture with a GUID is present in the UserPhotos folder….then you’re ready to run:
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 –MySiteHostLocation <mySiteHostURL>
This will update the pictureURL column in the userprofile_full table (user profile db) in SQL for your test user as well as generate 3 additional pics in the user photos folder.