CJ

The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

Importing AD Employee Photos into SharePoint User Profiles

Posted by CJ on May 8, 2009

I was recently asked to provide a process for importing Employee pictures into SharePoint so they would show up in search results and various OOTB web parts. This particular client has MOSS but doesn’t use My Sites.

This post by Henry initially helped me out.

They didn’t want the individual users to have the abilty to upload their own photo’s or modify them in any way, this was to be managed by IT.

  1. Create a Picture Library in your Intranet. This will store the photo’s for each employee. When storing employee photo’s chose the filename carefully if you want to populate the AD using scripts. I use something like cjames.jpg which is a correlation to the users account name.
  2. In Active Directory choose an AD property that will be mapped to your SharePoint User Profile Property. In my case I selected the extensionAttribute1 field that is located in the ExchangedAdvanced tab ((note this field may not show up if the Exchange Mgt Console hasn’t been installed)
  3. Populate this field with the URL to the employee’s photo that is in the Picture Library e.g http://sitename/ProfilePhotos/CJames.jpg (look below for a script example)
  4. In SharePoint SSP click the User Profiles and Properties link
  5. Click the View Profile Properties under the heading User Profile Properties
  6. Find the Picture property and select the Edit menu item
  7. Make note of the Usage: Number of profiles using this property. This should increase after we complete a full import
  8. At the bottom of the screen make sure Master Connection is selected and in the Datasource field to map select extensionAttribute1 (note: this field may not show up if the Exchange Mgt Console hasn’t been installed)
  9. Click Ok
  10. Complete a StartFull Import
  11. Once the full import is complete go back into the the Picture property and again check the Usage:Number of profiles that use this property. This should now contain some values.
  12. Verify this by viewing an Employee’s profile and the Picture property

Some things I had issues with:

  • Make sure your Import Connection service account has “Manage User Profile” permissions
  • May need to execute a Full Search crawl once photos are uploaded in the Picture Library

I also wrote a script to populate the AD extensionAttribute1 field as there were over 1000 employee’s and no one put their hand up for this job. The import thing here was for employee photo images to have a one to one mapping with their login account name (samaccountname). The person who runs this script also needs certain permissions in AD to update AD accounts. I would initially comment out the On Error Resume Next so you see if your account has enough privleges or not.

The script is very limited but hopefully it may provide some insight.

‘On Error Resume Next
Set objParent = GetObject(“LDAP://OU=Users,OU=Austraila,OU=Offices,OU=AU,DC=domain,DC=local“)
objparent.Filter = Array(“user”)
for each objUser in objParent
  Wscript.Echo “Modifying ” & objUser.Get(“samaccountname”) 
  objUser.put “extensionAttribute1″, “http://sitename/ProfilePhotos/” & objUser.Get(“samaccountname”) & “.jpg”
  objuser.Setinfo   
next

Wscript.Echo “End”

Now, IT are responsible whenever they create a new account they must also populate the extensionAttribute1 field with the URL of the picture library and the employee’s picture filename will always be their account name.

13 Responses to “Importing AD Employee Photos into SharePoint User Profiles”

  1. Henry Ong said

    Thanks for the script Clayton!

  2. Mate, I’ve just gone a few steps further than this…I’ll post on it shortly ;-)

  3. CJ said

    Hi J

    Post your url here when you have it finished so we can all have a look.
    Thanks

  4. [...] Importing AD Employee Photos into SharePoint User Profiles. [...]

  5. [...] Importing AD Employee Photos into SharePoint User Profiles. [...]

  6. Corey said

    I have followed the process you listed but when I am editing the picture property there I see no field for “Manager field string format in AD” so I cannot specify the attribute. Any ideas?

  7. Scott said

    Have followed the steps above but don’t have as per step 8 an option for selecting Datasource field to map select extensionAttribute1? Any ideas I’m using Exchange 2007 in my Organisation.

  8. steve said

    Where do we have to have exchange mgmt tools installed? On the Sharepoint App server??

  9. Keith said

    I’m in the same boat as Corey and Scott above – I don’t see any drop-downs below the Master Connection to allow me to map the attribute. I think it’s a permissions issue, but I’m able to run the Import job using the service account.

    Corey, what did you figure out?

    thanks,

  10. CJ said

    @scott, @steve, @keith
    You need to install the exchange mgt tools on the Active Directory server

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>