They have an HR database which they use to store everything from employee details to security card information. For this reason they manage all of the employee photos here, and they are pushed into Active Directory (using the LDAP "jpegPhoto" attribute) to make them available in applications like Outlook.
So ... to put it quite simply .. they don't want to use SharePoint to upload their photos. In fact, they already have their photos in AD .. they just want to pull them into SharePoint 2010.
Can't we just map the Profile Property to AD and Import the value?
So here is where we hit the roadblock.. The Active Directory "jpegPhoto" attribute is of type "Binary Data" and the SharePoint 2010 User Profile property is of type HyperLink (as it typically links to an image in an Asset Library in the My Site Host site collection).
As a result, you cannot import it using SharePoint 2010 functionality (although it may be possible if you have also purchased the more sophisticated "ForeFront Identity Manager Synchronisation Server" product).
Options ??
Well .. SharePoint IS used as a development platform so there are some options. Obviously there is a full API for reading and writing in and out of the User Profile database (some more accessible than others).
There are a few good blog articles that you can follow if you want to build your own import function. If you are happy to wait a while longer then I already have my own solution which I will be posting up with the following features:
UPDATE - Full Source code and WSP now published
* WSP Package
* Farm scoped feature, which installs a Timer Job attached to the MySite web application
* Iterates through all User Profiles, and finds and extracts Binary image data from Active Directory
* Automatically creates thumbnailed images in the My Site Host Asset Library
* Automatically updates User Profiles to point to those new images
During my research Glyn Clough also pointed me in the direction of another solution which allows you to do the same using a Console Application... personally I prefer the more "SharePoint" route of Timer Job and WSP package :)
In the meantime, you can feel free to avail yourselves of these posts:
- MSDN Blog - Background information on why you cannot import the property from AD directly
- Blog Post - How to upload a user profile photo programmatically
- Technet Blog - Programmatically using the jpegPhoto attribute in Active Directory
Hi, have you by any chance created this wsp yet?
ReplyDeleteSure, I've got the code finished, tested and working.
ReplyDeleteI just need to package it all up and post it on my Sky Drive .. I promise it will be available (both code and installable WSP) by Monday :)
I've updated now to include full source code and an installable WSP
ReplyDeleteThanks!
Hi Martin,
ReplyDeleteGREAT solutions, thanks.
But... i get this error when the timerjob runs:
Object reference not set to an instance of an object.
Help.
Br
Gert
IT-Administrator
Hi Gert,
ReplyDeleteI did test this on my SP2010 farm.
Could you send me more details?
(martin.hatch@hatchsolutions.co.uk)
Do you have any kind of stack-trace error?
(is there anything in the ULS logs?)
Also .. is this using the installable WSP or the code package?
Hi Martin,
ReplyDeleteThanks for your quick reply.
I have just mailed you with some more informations.
Br
Gert
hello,
ReplyDeleteWith the CU August 2011 that doesn't work in my farm :(
i have no error in log but there is no picture.
hmm .. might be an August CU issue.
ReplyDeleteThis was written a while ago! ;)
In fact, I'm pretty sure one of the CUs actually provided this functionality "out of the box" (didn't it?)
really ? i don't see this option :/ do you know where is it ?
ReplyDeletethanks :)
ok i see :)
ReplyDeletei do a full sync, i get all picture :), i run the power shell command "Update-SPProfilePhotoStore -CreateThumbnailsForImportedPhotos 1 -MySiteHostLocation http://my" but the profil stay mapped on the old picture.
Can you help me ?
Thanks
hmm .. not 100% sure tbh
ReplyDeleteI haven't looked into MySite and Profile Photos for many months and this was mainly for a specific client project requirement.
Sorry
no problem, thanks for your time :)
ReplyDelete