In this post I’ll describe how you can import user photos from Active Directory (AD) into SharePoint 2013 and add them to SharePoint user profiles.
Firstly you’ll need to get your users’ photos into AD. I use AD Photo Edit from Cjwdev. The bulk edition is fantastic as it has command line support.
Once the user photos are in AD you need to update the SharePoint user picture property . Open Central Administration and navigate to your User Profile Synchronization Service Application. Click on Manage User Properties.
Scroll down to the Picture property and choose Edit from the drop down menu.
Scroll down to the Add New Mapping section. Choose your AD data connection, select the thumbnailPhoto attribute and click Add, followed by OK to save the change. This maps the SharePoint picture property to a user’s photo attribute in AD.
Run a full user profile synchronization.
Once the user synchronization has finished open the SharePoint 2013 Management Shell. Run Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation %MySiteURL%
The command could take a while to run. When it’s finished click on Manage User Profiles and search for a user and click on Edit My Profile.
The picture has been added to the profiles.
I am not getting any value in the Source data connection drop-down.
What is the procedure to populate values in that drop-down?
The source data connection drop-down includes your Active Directory import source, i.e. you need to have already configured a user import from Active Directory. This is done from Manage Profile Service -> Configure Synchronization Connections.
I’ve tried this and I have two issues. One I cannot select thumbnailphoto from the dropdown as it is empty. I’ve tried entering manually instead. Then when I come to run the PowerShell script I get a nasty red error with invaliddata in it. I am assuming these 2 issues are linked?
The thumbnailPhoto attribute is an attribute of a user’s account within Active Directory. Have you configured a user import source of type Active Directory (Manage Profile Service -> Configure Synchronization Connections)?
When mapping the SharePoint user attribute of picture to the AD attribute ensure you select the correct source from the drop down, which is your AD user import source.
The other thing to check is that the thumnailPhoto attribute isn’t already mapped to another SharePoint user property as the attribute drop-down only shows attributes that aren’t already mapped. Check existing mappings from Manage Profile Service -> Manage User Properties.
Thanks for your reply. Yes my user import is configured and it’s bringing across all my users. But when I go to the Edit User Profile Property screen the I can see my source connection in the drop down but the attribute dropdown is completely empty, in fact is greyed out and narrow. I am doing an AD import rather than a full user profile sync, would this make any difference?
richardstk commented: “The thumbnailPhoto attribute is an attribute of a user’s account within Active Directory. Have you configured a user import source of type Active Directory (Manage Profile Service -> Configure Synchronization Connections)? When mapping the SharePoi”
The AD import is almost definately the cause of the problem. These instructions are for SharePoint Profile Synchronization (as existed in 2010), rather than the new to 2013 SharePoint Active Directory Import.
When I run the powershell command I get the following-
PS C:\Users\XXXXXXXXX> Update-SPProfilePhotoStore -CreateThumbnailsForImportedPh
otos $true -MySiteHostLocation http://xxxxxxxxxx
Update-SPProfilePhotoStore :
UserProfileApplicationNotAvailableException_Logging ::
UserProfileApplicationProxy.ApplicationProperties ProfilePropertyCache does
not have 525afc2b-cc75-4baa-89c7-4b3db1b185f2
At line:1 char:1
+ Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos $true
-MySiteHostL …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidData: (Microsoft.Offic…ofilePhotoStore:
SPCmdletUserProfilePhotoStore) [Update-SPProfilePhotoStore], UserProfileAp
plicationNotAvailableException
+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.
SPCmdletUserProfilePhotoStore
Check that the service account running the Distributed Cache has full control of the User Profile Service Application.
The Distributed Cache runs as the AppFabric Caching Service, so check the “log on as” account in Services.msc. Then, grant that account Full Control by going to Central Administration -> Managed Service Applications. Highlight the User Profile Service Application and click on Permissions in the ribbon.
Thanks. I am running the DC under my farm account and it already has full control. I did a little more digging and found a post suggesting that I log into the server with the credentials running the DC. I did that and it appears to be happy. Gonna let it run over night to see if I have pics or not =)
Progess! Some photos made it live, but the overall task failed with a rather cryptic error-
Update-SPProfilePhotoStore : Cannot remove file
“0c37852b-34d0-418e-91c6-2ac25af4be5b_19735.jpg”. Error Code: 6404.
At line:1 char:1
+ Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1
-MySiteHostLocat …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidData: (Microsoft.Offic…ofilePhotoStore:
SPCmdletUserProfilePhotoStore) [Update-SPProfilePhotoStore], SPException
+ FullyQualifiedErrorId : Microsoft.Office.Server.UserProfiles.PowerShell.
SPCmdletUserProfilePhotoStore
Any idea where I can find this photo to manually remove it? Also Once this is completed, will new photos from AD automaticly be sync’d over, or will this process need to be repeated on a periodic basis?
Great to hear you’ve made some progress! I’m not sure how to remove the jpg file, but the guid in the filename may be a user’s guid. When I view a user profile in the User Profile Service application, the URL is http://%SERVER%/_layouts/15/ProfAdminEdit.aspx?guid=c91cfb14-f580-4aef-a2ef-35a1f9c72385&q=%SEARCHTERM%&ConsoleView=Active&ProfileType=User&ApplicationID=94d5f79c%2D3647%2D4a76%2D9389%2Dfe39c3fb3314. Maybe you can manipulate the URL in your environment to see if the guid corresponds to a user account, which might help you make progress. You could also take a look in the ULS log to see if that contains any more information.
In my environment I have to re-run the “Update-SPProfileStore -CreateThumbnailsFromImportedPhotos …” PowerShell command to update the images. You could set this up as a Windows scheduled task.
On the off chance the access denied was just routine file locking I re-ran the command over the weekend and it completed successfully. Thanks for the help Richard. Looks like one more thing to add to my maintenance script.
Richard
Thanks to your blog, I’ve managed to get the staff photos import working with Sharepoint 2013 for the first time since I set up my farm! The key to this was the fact that the thumbnailPhoto field can only be mapped by using the old method of importing – not using the Active Directory one. This is the first time I have heard this mentioned and makes you wonder what the point of it is!
Thanks
Bob
Great to hear you’ve had success!
Thanks! Found this another great step by step guide to Import User Pictures from Active Directory to SharePoint 2010 My Site: http://salaudeen.blogspot.com/2013/01/import-user-pictures-from-active-directory-to-sharepoint-2010-mysite.html
Hi, I’m trying to accomplish this with on-site Sharepoint 2013. I have done all the steps and the “Update-SPProfilePhotoStore” completes quickly with no errors. Still, no picture is showing in My Site. However, when I hover the mouse over a users name in a link etc, the picture from AD shows up.
Any idea?
Hi Kyrre, I had the same problem and When I checked my ULS logs I got errors complaining about Distributed Cache.
Unexpected Exception in SPDistributedCachePointerWrapper::InitializeDataCacheFactory for usage ‘DistributedLogonTokenCache’ – Exception ‘Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.
You might want to check your token service and the distributed cache service.
Great post, worked like a charm!!!
Pingback: SharePoint 2013 – Edit User Profile Property – Mapping Attribute dropdown empty | Question and Answer
How about removing photos? I have a user where the his thumbnailphoto attribute on his account has been removed, but the profile sync is not removing it from SharePoint 2013. Any idea how to get this to work?
Pingback: SharePoint 2013 – Creating a Staff Directory in 7 Steps | SharePoint, CRM, Project Server, Office 365
This is the only steps you need to know to “Import User Photos From Active Directory Into SharePoint 2013” I went through all the steps in this blog and everything worked perfectly.
Reblogged this on and commented:
This is the only steps you need to know to “Import User Photos From Active Directory Into SharePoint 2013” I went through all the steps in this blog and everything worked perfectly.
Pictures uploaded to Active Directory will also be displayed in Outlook contact cards and in GAL contacts as well.
Hi Richard, if users already have uploaded their picture to SharePoint the AD sync, will the AD picture over write the SharePoint one? Will this then show no picture if one is not present in AD but is in SharePoint pre sync? Can users override AD sync with a different picture or is this a one way sync?
thank you for this useful article,
but i have a weird problem, in the my site the users have wrong profile picture ….
do you have any suggestion?
Let’s say you did all this and it’s working. Then one user has their picture updated in AD. Just to get that change to come through, will incremental sync do it? Can you just run the Update-SPProfilePhotoStore command only? Or do you always need to do a Full Sync first? Seems crazy to need to do a Full Sync just for one picture.
When new photos added to AD should I do full sync or will the incremental sync update the new photos. Enlighten me please!
In our AD new photos are added and i did full sync still the pictures are not showing up in userprofile. Any idea on this.
Pingback: Sharepoint User Not In Active Directory | Machoupichou
Pingback: Sync image in user profile – Knowledge-Base
HI,
We have multiple AD connections for the same userprofile.After sync and running the import photos command it added the photos in user profile but the issue is we have one user with same login name like domain1/abc and domain2/abc.After running the updateprofilestorecommand its updating the domain2/abc user photo to domain1/abc user photo.
Any suggestions?