Tuesday, December 20, 2011

Loading pictures to Active Directory via FIM

I've recently noticed a few discussions (one thread is in the FIM 2010 forum) on how to get pictures loaded into FIM and maybe into Active Directory (AD); for a recent customer project I did a VERY quick Extensible Management Agent (ECMA) with an extension to load pictures from a file share and into to FIM.

I want to strees that this ECMA has not been extensively tested for production and is missing some error handling and good logging. But it is currently running a burn-in at customer site and seems to be working properly, so if it will help you go in the right direction - well, then it is all yours for inspiration.

The current version basically loads JPG files from a file share specified as a Config Parameter and turns the pictures into a Base64 string. The Extension then actually converts the string back to a byte array which can be directly exported to Active Directory thumbnailPhoto.

Remember that the general recommendation is to store pictures in Active Directory at a size of 96x96 pixels and a size of less than 10Kb; however, I have heard from Microsoft that the attribute thumbnailPhoto actually supports up to 100Kb size pictures, so you'd would have to check with the different applications for size and dimensions expectations, i.e. Outlook enjoys a 96x96 picture but other application may have other preferences and SharePoint generates three different size, 144x144, 96x96 and 32x32 pixels for use in different situations.

Get the compiled version and source code for both the XMA and the Extension here.

Enjoy.

2 comments:

Stephen K said...

Hi Soren,
I've been toying with this exact problem and found your Blog. I'm new to FIM so am trying to learn all I can. This is excellent to have someone post something I can actually start leaning from - Thankyou.

Unfortunately I've yet to make the MA work as designed - however it has put me in a space which identifies a knowledge gap and perhaps you may be able to assist with this - I've downloaded your project built and have the DLL in my extensions folder -

Build the DLL as packaged – no alteration at this stage just trying to see what it does and How

created an "IMPORT" / "Call-based" MA (have tried File-based but do not get as far)

-- Template file
Id:
Picture:

-- variables
MaxWidth = 500
SourceDirectory = c:/tmp/staff
FileSearchFilter = *
RegExReplaceFilter = .JPG

-- Directory with JPEG files – Staff id for the name

0001.jpg
0003.jpg

I’ve not changed any of your code I was expecting I will do this after I have the baseline working.

The .tmp File has been created and there is data however it does not seem to be updating FIM

I had expected to see the “test” file – would it have been consumed by FIM ?

Unfortunately I've been unable to Use MSVS Debug as it's not connecting for some reason to the server correctly, and there does not seem to be anything in the windows logs.

Søren Granfeldt said...

Hi, Stephen

Thank you for trying it out. I can't offer support here, but I would recommend that you have a look in the forums (http://social.technet.microsoft.com/Forums/pl-pl/ilm2/threads) where you can get good help for almost anything related to FIM.

Good luck with your ongoing quest to learn FIM.