SharePoint Server 2010 Supplementing User Profile Imports Using BCS

SharePoint 20 July 2010 | View Comments

The User Profile Service Application is used to synchronise data from Active Directory to the profile database maintained by SharePoint. The profile database contains rich information about end users that can be displayed in sites. The User Profile service application maps Active Directory fields to fields in the user ’s profile. On a scheduled basis, this information is imported from Active Directory.

But, what happens when you want to add additional information from external systems to supplement the richness of you Active Directory data? Well, you need to use BCS (Business Connectivity Services). BCS is an evolution to the functionality of MOSS’s (Microsoft Office SharePoint Server) 2007 BDC (Business Data Catalog).

What started out as a simple lab to get a proof of concept up and running really turned into a bit of a hair pulling ordeal. I’ll go through it here so that someone else doesn’t have to go through the same stress as I had to. From what I gather there’s quite a few people out there who are trying to get this running but are faced with the dreaded error;

“Microsoft.MetadirectoryServices.NoSuchObjectTypeException: No such object type “user”.
at Microsoft.MetadirectoryServices.Impl.TypeDescriptionCollectionImpl.get_Item(String Name)


So. Onto the Step by Step guide to enlightenment, so I hope. Just as a note, I’ll be importing some Customer details into my profile from the Northwinds sample database. This database can be downloaded from;

http://www.microsoft.com/downloads/details.aspx?familyid=06616212-0356-46a0-8da2-eebc53a68034&displaylang=en

Firstly go ahead and download the database. You can either run the .sql file to create the DB or simple to an attach. Once you have the DB attached to your SQL back-end you should be able to query the sample data as follows;

This is the sample data we’ll be using. In our simple test I’ll be adding an Alternate Company to my Active Directory profiles, this data will be pulled from the Customers table using the CompanyName table.

The first thing we need to do is create and ECT (External Content Type). With BCS the focul point is, it’s all about External Content Types definitions. The simplest method of generating these ECTs is using SPD (SharePoint Designer) 2010. Once we’ve created our ECT it’ll be stored in the ECT Catalog, also known as the metadata catalog.

So lets fire up SPD and create an External Content Type. Open up a Team Site where you want to test out your ECT. To ensure our ECTs are working we’ll create a list afterwards and display the Northwinds customers using the SharePoint native interface.

In SPD go to External Content Types in Site Objects.  Click External Content Type. You’ll be presented with a new ECT page;

Enter a Name such as NorthwindCustomers. Enter a Display Name as Northwind Customers. In my example I’ve changed the Office Item Type to Contact as I want to take the list offline for later use. It’s up to you, the only extra step you need to do is map the properties in the Northwinds database to Office properties.

Click the Click here to discover external data sources an…  Click Add Connection and select SQL Server. Fill in  your Database Server, Database Name and optional name. Leave Connect with User’s Identity as the default. Once you have done this, you’ll notice that your Northwinds database has been added to your Data Source Explorer as follows;

Expand your Northwindows database and right click Customers. Select Create All Operations.

You should be presented with Operations Properties wizard now. For the ease of this guide I’ve selected All Operations but in your day to day BCS solutions you might want to limit what you want you users to perform using CRUD (create, replace, update, delete) for security sake.

Select Next on the Operations Properties wizard. Since I’ve chosen the Office Item Type as Contact I will now need to map the Data Source Elements such as CompanyName to an Office Property like Company Name (CompanyName). I will also check the Show In Picker box as I want to be able to view the results from any searches. Perform these steps for as many elements as you see fit. A word of warning too, leave the CustomerID Data Source Element as Read-Only in the Properties. You dont want your users overwriting your identifier for the field that we’ll use later for our 1 to 1 profile relationship.

Click Finish. Then select Summary View in SPD to view your settings and save your changes. They should look something like this.

Congratulations. You’ve just created your first ADO.NET ECT and now we’re ready to expose the contents of our Customers table from the Northwinds database. The simplest method to create your External List and InfoPath form is to use the Create Lists & Form button on the SPD ribbon. Select the newly created ECT and then select Create Lists & Form from the ribbon to bring up the. Fill in the List Name details and also check the Create InfoPath Form checkbox. Your entry should look something like this;

Once you click OK this will go ahead and create the External List and InfoPath form in the Team Site that you used when creating the ECT. If you refresh your Team Site home page you should see a new list in the Quicklaunch bar. Before you can use the your new ECT you need to set the permissions for your ECT else you will receive the following message;

Access Denied by Business Data Connectivity.

To apply the permissions for your ECT you need to go to your Central Administration > Manage Service Applications > Business Data Connectivity Service > Select the Set Permissions action on your ECT. Open your People Picker up and search for All. Select your All Authenticated Users and check each Permissions that you would apply to this user/group. For our guide we’re allowing all permissions on this ECT for the All Authenticated Users group.

Once you set your permissions on the ECT you will be able retrieve the Customers table from the Northwind database as follows. A word of caution, you will need to close down your browser session and open your Team Site up again as you need to re-authenticate against the site again for the External List to work work.

Congratulations, you’ve now you’ve created your first External List based on a ADO.NET External Content Type. Imagine the possibilities in connecting out disparate LOB (Line of Buiness) systems out there in your organisation and having them surfaced by using native SharePoint External Lists, this is only the tip of the ice berg on what is possible.

Now I’m going to assume that your profile imports are working correctly when importing from Active Directory (AD). If you’re AD imports aren’t working then please get that up and running and move on to the next steps. A word of notice is that the BCS profile import cannot be the primary data source for profile imports, we can only supplement information from LOB systems and add them to our AD Profiles.

In this example as I mentioned initially, I’ll be adding an Alternate Company to my Active Directory profiles, this data will be pulled from the Customers table using the CompanyName table. The first step we need to perform is by adding a new User Property. In my example I will add to each user a Alternate Customer ID field that will have this fields data correlate back to the CustomerID column of the Customers table, this is how we establish our 1 to 1 relationship between our AD profiles and our BCS profiles. This Alternate Customer ID propoerty will only be a SharePoint local property, but in a real world example this can be brought in from Active Directory via one of the other attributes.

To create the new User Property go to Central Administration > Manage Service Applications > User Profile Service Applications > Manage User Properties. Select New Property and fill in the contents as follows.

Name: CustomCustomerID
Display Name: Alternate Customer ID
Type: String
Length: 5 (Since our column CustomerID is on 5 nchar in the Customers table)

Under Policy Settings change the Required Policy Setting to Optional. The rest of the property settings can be set however you like. Click OK and we’re ready to start setting up our BCS User Profile Synchonrization Connetion. Go to your User Profile Service Application > Configure Synchronization Connections > Create New Connection.

Enter a Connection Name as Northwinds, Type as Business Data Connectivity. In the Business Data Connectivity Entity select your Northwind Customers External Content Type. Now this is the import part, we need to map our CustomCustomerID to our Extrernal Content Type to create the 1 to 1 relationship. Select our CustomCustomerID property as the identifier.

Click OK and save your now synchronization connection settings. Now, we need to quickly jump back in the Manage User Profiles page and add the Alternate Customer ID data in. This will then be used to import the Alternate Company Name via BCS. Like I mentioned previously, instead of an Alternate Customer ID property that we have here, you can use an AD attribute to perform the same function, usually a mail or employeeid attribute is the way to go, anything which correlates your HR systems and AD will work.

Before we can start the profile import we need to add another User Property that will surface the Alternate Company Name data from the CompanyName column. Create a New Property with the follow values;

Name: CustomCompanyName
Display Name: Alternate Company Name
Type: String
Length: 40 (Since our column CustomerID is on 40 nvarchar in the Customers table)

Under Policy Settings change the Required Policy Setting to Optional. The rest of the property settings can be set however you like util you scroll to Property Mapping for Synchonization. Select Northwinds as the Source Data Connection, select CompanyName as the Attribute. Click Add to the add the Property Mapping to the new User Property.

Click OK and you are done with User Properties.

Lets go ahead and populate our Alternate Customer ID properties in some test profiles. I’ve got several properties imported here from my dev box so I’ll go ahead and add the CustomerID data from the Customers table in the Northwind database. As a simple test, you can add 1 or 2 Alternate Customer ID entries initially and the profile import will only import those 1 or 2 BCS profiles. So I’ll add 2 for now and we’ll check the Forefront Identity Manager 2010 client that those 2 profile are only imported.

Lets add ALFKI as the Alternate Customer ID to one of our profiles, which is the first record in the Customers table. Lets find another profile and add ANATR to the Alternate Customer ID. Once we perform a Full Import will expect to have the Alternate Company Name supplemented by our BCS import.

We’ve pretty much set up all the plumbing, lets kick off our Full Import. Go to Central Administration > Manage Service Applications > User Profile Service Application > Start Profile Synchonization > Start Full Synchronization.

With Microsoft SharePoint Sever (MSS) 2010, Microsoft has opted to use Forefront Identity Manager (FIM) 2010 instead of the SharePoint Search engine to perform the profile imports. With the install of MSS we also have the miisclient.exe that allow us to view and check certain preoprties during and after the import. You can find the tool in the following directory;

C:\Program Files\Microsoft Office Servers\14.0\Sychonization Service\UIShell

Open up miisclient.exe and view the impending profile import.

If all the steps were carried our correctly you will have success as the resultant message in the Status column all the way through. Success! All done.

Now if you check any of you modified user profiles that you added your Alternate Customer ID, you will notice that the Alternate Company Name has been supplemented. Phew! That was a long guide.

When I initually ran across the No such object type “user” error message what finally allowed to me fix the problem was drilling further into the workings of the miisclient.  Open the miisclient, go to Management Agents > Select MOSSBDC-Northwinds > Select Proprties in the Actions Menu > Configure Additional Parameters.

Notice on the righthand side the MossJoinAttribute and BDCJoinAttribute.

Ensure that these attributes are the correct entries for the 1 to 1 relationship between your LOB system and your MOSS profile. BCS needs to know how to correlate these two fields together to supplement each user’s profile, hence the error.

Hope this helps quite a few of you out there as I know this was a major feature we had to get up and running for our global rollout.

Kristof Kowalski / kristof@kowalski.ms

View Comments on “SharePoint Server 2010 Supplementing User Profile Imports Using BCS”

Leave a Reply

blog comments powered by Disqus