Import User Profile Photos from Active Directory into SharePoint 2010

Posted: 11/18/2010 in Administration

Update: Post now resides at new blog site! http://www.tcscblog.com/2010/11/18/import-user-profile-photos-from-active-directory-into-sharepoint-2010/

 

Requirements:

  • SharePoint Server 2010 with at least the October Cumulative Update installed
  • Successfully working User Profile Service Application
  • Profile Photo stored in thumbnailPhoto AD attribute (I used the PowerShell script found here to import the picture into the attribute)

Steps to Perform:

  • Create an import PictureURL mapping
  • Perform a full profile synchronization
  • Run the Update-SPProfilePhotoStore PowerShell command

Create an import PictureURL mapping

Edit the User Profile Picture property by navigating to Manage Service Applications > User Profile Service Application > Manage User Properties > Picture

Make sure your Active Directory profile connection is selected, and then choose the thumbnailPhoto attribute and Import direction

Since you’ll be controlling the profile photos from Active Directory, change Edit Settings to “Do not allow users to edit values for this property”

Click OK to make the changes

Perform a full profile synchronization

Manage Service Applications > User Profile Service Application > Start Profile Synchronization


The synchronization may take a while, so be patient.

Once completed, if you go to the profile page you’ll notice that the image wasn’t added.


Run Update-SPProfilePhotoStore PowerShell Command

Launch the SharePoint 2010 Management Shell (Start > All Programs > Microsoft SharePoint 2010 Products > SharePoint 2010 Management Shell) and run the following command:

Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation
http://<YourServerName>/my


Now go back to the profile page to review the results




Advertisement
Comments
  1. Chris Poteet says:

    If this property in UPS is set to export and edit by the user will it sync bad to AD if you upload a photo in a my site?

  2. Greg says:

    Hi, this works but it doesnt seem to create all the 3 size that sharepoint uses needs, it only seems to create the large one. Have you any experience with this?

  3. [...] Import User Profile Photos from Active Directory into SharePoint 2010 – [...]

  4. Tyler King says:

    Finally got this to work, you must add permissions for youself in both administrator and permissions on the User Profile Service Application. Also, wanted to see if there is a way you can add a custom job so this can run every so often and update profile pictures without manual administrator interaction.

    • Tyler King says:

      Ran a windows task everyday at 6AM to run shell commands, now our SharePoint syncs photos automatically.

  5. Samer Shennar says:

    The Man. Shell says it does not know property CreateThumbnailsForImportedPhotos. Any idea?

  6. Kazim Raza says:

    Hi,
    I followed the steps and I can see the images with different sizes in the Profile Photo Library, but at the user profile page instead of image there is a red cross (which means image not found) can you suggest what could be the problem.
    Thanks!
    Kazim Raza

  7. Fernando Possebon says:

    Adam,

    I followed the steps but it’s not working. I did not get any error message, and tested for 3 different users the photo on thumbnailPhoto AD attribute it’s not synced in SharePoint.

    Any idea in troubleshooting this?

    Thanks

  8. Ron says:

    Adam, I’ve tried for a few days to get this to work with no success. One problem is that the command “Update-SPProfileStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http:///my” throws the error “A parameter cannot be found that matches parameter name ‘CreateThumbnailsForImportedPhotos’”. I did get the command to run successfully by using “Update-SPProfileStore -MySiteHostLocation http:///my“.

    The second problem is that during the profile synch, ForeFront is throwing ma-extension-errors that the URI could not be determined. I think that this may have to do with a mismatch of picture data types. SharePoint is expecting a URL while AD is supplying an Octet string. Any ideas how to get these errors resolved?

    Thanks for any help you can provide.
    Ron

    • sptwentyten says:

      @Ron – Is your 2010 environment patched to Oct CU or later? That includes the update to the Update-SPProfileStore command. Make sure you have the proper permissions to use PowerShell via Add-SPShellAdmin, or make sure you try the command as the SharePoint Farm Account

  9. [...] and can be easily solved in various ways. One of them is described here (Hebrew) using FIM or here (English) using simple [...]

  10. Gloria says:

    You are the best, worked like magic. i was leaving out the •Run the Update-SPProfilePhotoStore PowerShell command

  11. Carpadum says:

    Check out codetwo active directory photos. http://www.codetwo.com It’s free and very easy to use when uploading photos to AD.

  12. Teddi says:

    Do you have to be using mysites to be able to synchronize the pictures from AD to Sharepoint? I am able to synchronize other attributes from AD but not the picture.

  13. J.Jespersen says:

    I can add the mapping to the “thumbnailPhoto” just fine, but when I want to save/exit the property settings page by clicking “OK” in the bottom of the page, it just hangs and eventually states (near the top): “An error occurred when updating a property.”

    Any ideas, anyone?

    • J.Jespersen says:

      Solved that part now. Had just installed SP1 and June ’11 Cumulative Update, but had not SPUpdate’ed my databases. Still have problems though. Will start a new thread. :-)

  14. vijaykishan says:

    Hi,

    Thanks Guys.

    We are having a FBA based site. It looks like update command works well when my sync connection is windows based and claimsuseridentifer is not mapped.
    In our case we need the conn to be forms based and claims user identifier – > samAccountName.
    ” Error processing the photo URL User Photos/Profile
    Pictures/0c37852b-34d0-418e-91c6-2ac25af4be5b_156.jpg for user i:0#.f|ad|……
    : System.UriFormatException: Invalid URI: A Dos path must be rooted, for
    example, ‘c:\’.”

    Any help will be useful

  15. Susana says:

    Hi!

    Great post, very useful and very clear.
    We have followed your steps:
    - In AD we have binary data in thumbnailPhoto attribute
    - We run a full profile sync
    - We executed
    ‘Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation
    http:///mysite
    The command is executed with no errors.

    But in User Profile we don’t see any photo, library ‘http://srv/mysite/User%20Photos/Forms/AllItems.aspx’ is empty.

    Please, could you tell us what we should check?

    Thanks!

    Regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s