Navigation

Thursday, 4 November 2010

Active Directory Images are not imported by the SP2010 User Profile Import

This is something that I found when starting a new SharePoint 2010 (SP2010) Intranet project. You see, my client has quite a simple requirement, at least it seems that way at first.

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:


12 comments:

  1. Hi, have you by any chance created this wsp yet?

    ReplyDelete
  2. Sure, I've got the code finished, tested and working.

    I 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 :)

    ReplyDelete
  3. I've updated now to include full source code and an installable WSP

    Thanks!

    ReplyDelete
  4. Hi Martin,
    GREAT 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

    ReplyDelete
  5. Hi Gert,

    I 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?

    ReplyDelete
  6. Hi Martin,
    Thanks for your quick reply.
    I have just mailed you with some more informations.

    Br
    Gert

    ReplyDelete
  7. hello,

    With the CU August 2011 that doesn't work in my farm :(

    i have no error in log but there is no picture.

    ReplyDelete
  8. hmm .. might be an August CU issue.
    This 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?)

    ReplyDelete
  9. really ? i don't see this option :/ do you know where is it ?

    thanks :)

    ReplyDelete
  10. ok i see :)

    i 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

    ReplyDelete
  11. hmm .. not 100% sure tbh

    I haven't looked into MySite and Profile Photos for many months and this was mainly for a specific client project requirement.

    Sorry

    ReplyDelete
  12. no problem, thanks for your time :)

    ReplyDelete

This blog has been moved to www.martinhatch.com

Note: only a member of this blog may post a comment.