R – sharepoint and ActiveDirectory

sharepoint

Hi guys i am new to sharepoint . Actually we are using WSS not the MOSS 2007. we don't have shared service provider installed and no user profile service web service installed.Now I need to populate the active directory data to sharepoint list and after that I have to sync both Active directory and sharepoint list.which means the changes happened to Active directory data it must reflect in sharepoint list also.

What we are doing is extracting active directory data to SQL Server database and populating sharepoint list from SQL server database. I need a solution to populate sharepoint list from SQL Server database and sharepoint list must synchronize with SQL Server database table or stored procedure all the time automatically.

Can anyone suggest me the best solution to solve both importing the active directory data and sync the active directory and sharepoint list.

If anyone of you provide the sample source code that will be helpful.

Best Answer

I just want to clarify a bit first. Not sure if you're looking to configure sync for proper user profiles (which mundeep's answer solves nicely) or a generic SP list.

If you're looking to:

AD <-> SharePoint list

It's probably easier to break this problem down into two parts:

AD -> SP list

and:

SP list -> AD

For AD -> SP list

Microsoft provides some guidance on monitoring the AD for changes. Unfortunately, neither of these methods is a specific event message system (if anyone knows of one, please chime in!) both are essentially polling.

I would create a Windows service to handle this part of the solution.

The service would (in pseudo-code):

  • look for records that have changed
  • for each record that has changed:
    • get the matching SP item from the SP list (probably based on username)
    • update/add/remove the properties of the SP item
    • save the SP item

For SP list -> AD

I would create a custom event handler and attach it to the SP list.

Again in pseudo-code:

On SP item delete:

  • remove the matching AD record (if that's the behaviour you want)

On SP item create:

  • create a new AD record

On SP item update:

  • find the matching record in the AD
  • update the changed properties (which are flagged in the SP event handler)

The SP side of things is a little more elegant because events are raised only when something happens. This is definitely more efficient than polling.

What I'm suggesting has the added benefit of removing SQL (explicitly) from the solution. You can use the ADSI interface in the .NET framework to handle the AD update code. It's in the System.DirectoryServices assembly.

The AD polling service could use the SP object model if it's installed on the WSS box or the web services if it's on another system.

Again, if you're just looking to use the actual WSS/SP user profiles, use mundeep's solution.

Related Topic