Partilhar via


SharePoint - import a picture from AD for the user profile

Consider the following scenario.

 You have JPG pictures in AD, stored with the users thumbnailPhoto attribute.
 You try to import pictures for a user profile from the Active Directory thumbnailPhoto attribute,
 to store within the Picture attribute in Microsoft SharePoint Server 2010.

 You have set up an import Picture URL mapping.
 User Profile synch and mysites are configured and working fine.
 Then, you perform a full synchronization in the SharePoint server.

In this scenario, the pictures are NOT added to the user profile in the SharePoint server.
(easy test - look at your MySite and select My Profile - do you see the new picture?)

hmmm...

Note: You CAN use following SharePoint PowerShell cmdlet command to perform the import operation:
Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation https://<YourServerName>/my
The cmdlet was introduced in this fix: https://support.microsoft.com/kb/2394320  (14.0.5128.5000)

You just map the thumbnailPhoto AD attribute with the Picture property in SharePoint, then run the sync, finally run the cmdlet.

create the Mapping in SP2010 or SP2013:
 go to Central Admin->Application Management->Manage Service Applications
 select your User Profile Service Application
 select the People->Manage User Properties tab
 in the left-hand column, look down and select the Picture property.
 edit this - down the bottom is 'Add New Mapping' and via the dropdown on Attribute, select thumbnailPhoto.
 it should then look like this:
   User Profile Synch Connection
   thumbnailPhoto
   Import
go back to the Manage User Properties and you should now see
   Picture URL thumbnailPhoto

OK, so now Synchronization->Start Profile Synchronization. Let that run through.
Next you will want to double-check your MySiteHostLocation.
select My Site Settings->Setup My Sites
grab the entry from My Site Host Location - that is what we need for the MySiteLocation parameter.

so, on the SharePoint box, launch a SharePoint PowerShell, (run as administrator).
the command will be as per below, with your path replacing "https://<YourServerName>/my"

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

Now, go back to your mysite, select your profile and... voila!!   the new picture has been pulled in from AD.

 Things that can go wrong:

  • Be on current Cumulative Updates. (Post Dec 2011 absolute minimum!)
  • User Profile Synch service has to be running/enabled/OK!
  •  Permissions:
    •  Service Applications->User Profile Service Application, click Permissions. 
          Add your account and check the Full Control checkbox.
    •  Service Applications->User Profile Service Application, click the Administrators
          Add your account there and check the Manage Profiles.
  • Site Collection Administrator for the My Site host
  • DBO access to the DB containing mysite host.
  • run powershell with 'Run as Administrator'

Comments

  • Anonymous
    January 01, 2003
    Good post.thanks.

  • Anonymous
    January 01, 2003
    Great post! I followed these steps and I can see user's pictures in People Search as well as in their profiles. The only point when I got error in PowerShell was that I was logged on with the 'Setup' account. Then I logged on with Farm admin account which had DBO permission on My Sites database and User Profile databases. Thanks! --Ashish

  • Anonymous
    January 01, 2003
    Worked for me too!!!

  • Anonymous
    January 01, 2003
    Great post!

  • Anonymous
    January 01, 2003
    Also, just to be clear, I did this in SharePoint 2013.

  • Anonymous
    January 01, 2003
    Useful post.

  • Anonymous
    July 04, 2013
    What if we are using another custom attribute that isn't showing in my data source to be able to map it. Can I do this through PowerShell?

  • Anonymous
    January 19, 2014
    Is there anyway to import the pictures from AD without having to have MySites setup?

  • Anonymous
    January 19, 2014
    Is there anyway to import the pictures from AD without having to have MySites setup?

  • Anonymous
    January 22, 2014
    The comment has been removed

  • Anonymous
    January 22, 2014
    What Am I doing wrong?????

  • Anonymous
    January 25, 2014
    Log on to the App server as the AppFabric Caching Service account and run the script. Should be ok.

  • Anonymous
    January 31, 2014
    @Rene http://richardstk.com/2013/04/12/import-user-photos-from-active-directory-into-sharepoint-2013/

  • Anonymous
    March 21, 2014
    I'd also like to know (like Fiona) if there is anyway to import the pictures from AD without having to have MySites setup? Thank you.

  • Anonymous
    March 25, 2014
    Same as Betsy and Fiona, can I import pictures from the AD without setting up MySites?

  • Anonymous
    April 16, 2014
    The comment has been removed

  • Anonymous
    April 24, 2014
    Will this work with Office 365. We are trying to sync our AD thumbnail pictures.

  • Anonymous
    June 25, 2014
    Hey

    What could be the reason to not displaying my pictures in MySites or search, but when I hover the mouse over the profile-names I am able to see the picture I imported from AD, showing up in the pop-up.?

  • Anonymous
    July 31, 2014
    Frank Ball, you want Phase 2 of http://technet.microsoft.com/en-us/library/ee721049(v=office.15).aspx#StartUPSProc

    I also had the same issue until I followed that guide.

  • Anonymous
    August 05, 2014
    Hi Luke, just got a request to enable SPProfilePhotoStore, it's helpful. Thanks!

  • Anonymous
    September 11, 2014
    I'm experiencing the same as Frank Ball. Following all the steps, but the "attribute" dropdown stays empty. I then type in thumbnailPhoto by hand, and I don't see any pictures showing up.

    Is there any way to figure out if the binary value from AD is imported at all?

  • Anonymous
    September 12, 2014
    I have now pictures in my sharepoint, right from AM.

    What I had to do was to stop using Active Directory Import, and to start using SharePoint Profile Synchronization.

    I don't know if and why this makes sense, but it did the job for me. The "attribute" dropdown was now also filled.

  • Anonymous
    December 16, 2014
    I have Followed all the steps ,Ran the command successfully Still not able to see the images.....can any 1 help...?

  • Anonymous
    February 12, 2015
    It worked!. I wonder now if I can reverse it and have users submit their own photos.

  • Anonymous
    March 06, 2016
    Hi,

    Profile pictures are not importing to sharepoint. I could see either cross mark or blank photo and also i could see only GUID's in user photo list in my site host. I ran the full sync and also ran the update profile store command but still the same.

    Photos exists in sync database but not in profile database. Please help me in fixing this.

    Thanks in Advance.

  • Anonymous
    March 08, 2016
    will the profile sync process update a new/changed picture from ad.... or do we have to run the Update-SPProfilePhotoStore on a regular basis?

  • Anonymous
    March 09, 2016
    It was working fine but now its stopped getting the photo from AD and we ran the update-spprofilephotostore command.

  • Anonymous
    April 13, 2016
    You could follow this Guide, it works.
    https://cann0nf0dder.wordpress.com/2014/07/06/getting-sharepoint-user-profile-service-ups-importing-from-ad-with-pictures/

  • Anonymous
    September 29, 2016
    I tryed this on sharepoint 2016. but no luck.can anyone confirm if this works on sharepoint 2016??? please,Paulo

  • Anonymous
    January 16, 2017
    Hi, I have created userprofile service and imported all photos in sharepoint.But the issue is if we create any new profile in ad it syncing in sharepoint but its not syncing picture in sharepoint userprofile.I think if we ran the powershell command to update the mysite profile store it will create duplicate items.Any idea on this.

  • Anonymous
    October 27, 2017
    Hi when i syn my AD 2008 to SP2016 most user profile attributes able to populate in SP some UP dont have email show even in AD ID attribute have email indicated. And last in AD Attribute "thumbnailPhoto" show each user have photos with a hexdecimal but still never show up in SP user profile

  • Anonymous
    November 09, 2017
    Great Post

  • Anonymous
    December 20, 2018
    I have always set picture property mapping as export direction since self service will minimize IT work, but since we do not ask users to update their pictures, users are updating their pictures on outlook instead of SharePoint. Can i change the mapping to import direction, remove the existing export direction, full sync, and then put it back to export? Will it break anything?

  • Anonymous
    February 21, 2019
    I do all this in SP 2016 and no pictures are coming to the profile. I see no errors anywhere. I noticed SP 2013 had both "User Profile Service" and "User Profile Synchronization Service" but 2016 has only "User Profile Service".Anyone can explain this?Is there a way to upload a batch to the profile store?