Configuring Business Connectivity Services (BCS) Search in SharePoint 2010

One of the feature in SharePoint 2010 which has received one of the bigger facelifts is Business Connectivity Services (BCS) – what we used to call Business Data Catalogue (BDC) in SharePoint 2007. This is a really powerful set of tools for connecting external data into SharePoint. If you are not familiar with BCS, I’d recommend the following sites to get up to speed (the rest of this post assumes you are familiar with BCS).

Overview of Business Connectivity Services from the BCS Team Blog

Introducing the External Content Type from the BCS Team Blog

What's New: Business Connectivity Services from MSDN

Microsoft Business Connectivity Services general resources on MSDN

Create an External Content Type

One of the primary objects in BCS is the External Content Type. This establishes a link between BCS and the ‘entity’ in your data system such as ‘customer’, ‘order’, ‘product’ etc

You can very quickly create External Content Types using SharePoint Designer. There are plenty of articles on how to do this, here are a few that helped me:

External Content Type in SharePoint Designer – SQL Server from Lightning Tools Blog

How to: Create an External Content Type Based on a SQL Server Table from MSDN

(Video) Create External Content Types using SharePoint Designer 2010 from www.SharePoint-videos.com

Throughout this post, I’ll be using the Adventure Works sample database for SQL 2008 which you can get from here . Specifically, I’ll be using an External Content Type I created called ‘Products’ which is based on the the ‘vProductAndDescription’ view – if you want to follow my steps exactly, please pre-create this External Content Type, otherwise, whenever you see ‘Products’, substitute that for the name of your external content type.

Please ensure that your External Content Type has at least Read List and Read Item methods configured. These are the minimum methods required for search (and most BCS operations actually).

Set the Title field in the External Content Type

It is not mandatory that you configure a title property for your BCS external content type but this is essential if you want meaningful search results. You can configure this in SharePoint designer by following these steps:

  1. Open SharePoint designer and connect to the site where you created your External Content Type
  2. Open your External Content Type (open the site > External Content Types > Products)
  3. in the ‘Fields’ section in the bottom right corner of the summary page, highlight the ‘Name’ field and click ‘Set as Title’ in the SharePoint Designer ribbon
  4. Save your External Content Type.
Configure BCS Profile Pages

When users click on a BCS item from search result, the data for that BCS item will be displayed in the ‘profile page’.

This is basically an ASPX page with a few BCS web parts on.The view profile action passes the entity’s ID data into the query string and the web parts use this data to display the relevant BCS entity.

These profile pages are not setup by default, it is something that you must manually configure, if you do not configure you’ll get a ‘404’ error when you try to click on any BCS search results (I will not tell you how long it took me to figure that one out!! :) ). To configure the profile page follow these steps:

  1. Open Central Administration
  2. Navigate to ‘Create Site Collections’ (Application Management > Site Collections> Create Site Collections)
  3. Create a new ‘Blank Site’ to host the actual ASPX page called ‘BCS’ (or whatever you want to call it). It does not matter where this is on your farm, but make sure you note the URL. In my example this will be in https://mkearn/sites/BCS
  4. Navigate to the Manage Service Applications page in Central Administration (Application Management > Manage Service Applications)
  5. Click on the ‘Business Data Connectivity’ service application
  6. On the ‘Edit’ tab of the ribbon at the top of the page click ‘Configure’
  7. Enter the URL of the site you created in step 1 into the ‘Host SharePoint site URL’ field and click OK
  8. Select the ‘Products’ External Content Type using the tick box and click ‘Create/Upgrade’. This will create a new profile page and ‘View’ action for the External Content Type. Click OK to the warning.

No this has been created, you’ll notice that there is now a default action pointing to an ASPX page in the site you created where the ID is passed in via the query string.

Configure Indexing

Now that the External Content Type is fully configured, we can create configure the indexing.

BCS indexing is very simple, you simply add the BCS data source as a new search Content Source in the Search Service Application. Follow these steps:

  1. Navigate to the Manage Service Applications page in Central Administration (Application Management > Manage Service Applications)
  2. Click on the ‘Search Service Application’
  3. Go to ‘Content Sources’ (on the left hand side navigation)
  4. Click ‘New Content Source’
  5. Enter ‘Adventure Works’ (or whatever you’d like) for the name
  6. Choose‘Line of Business Data’ for the Content Source Type
  7. Tick the ‘start full crawl of this content source’ and click OK
  8. Leave the server for about 5 minutes to perform the index update. After this time click ‘Refresh’ on the ‘Manage Content Sources’ page, if the content source status is still ‘Crawling Full’ then allow some more time. You’ll know it has completed when the status is ‘Idle’
  9. To verify that the index has completed, choose ‘View Crawl Log’ from the drop-down menu for your content source. You should see around 296 successes for your content source (assuming you used the ‘vProductAndDescription’ view from the AdventureWorks2008 database)

In order to test the search you’ll need a site that is configured to perform enterprise searches. The easiest way to do this is to create a Enterprise Search Centre site. To do this, follow these steps:

  1. Open Central Administration
  2. Navigate to ‘Create Site Collections’ (Application Management > Site Collections> Create Site Collections)
  3. Create a new ‘Enterprise Search Centre’ site (under the ‘enterprise’ tab) called ‘Search (or whatever you’d like).
  4. Go to the Enterprise Search Centre site and search for ''bike” (again, this assume that you have used the ‘vProductAndDescription’ view from the AdventureWorks2008 database)
  5. Click on any of the results, this will load the full item in the profile page

PS: Happy Xmas and a Merry New Year! I hope you enjoy my special one-off profile photo! :)

This article was published by

SantaProfile

Martin Kearn Senior Consultant Microsoft Consulting Services UK Martin.Kearn@Microsoft.com

Click here for my bio page

Please feel free to contact me directly via email or via the blog comments if you have something to say about this article.