Mastering Business Connectivity Services in SharePoint 2010
Posted by: Mark Kendall
in Category SharePoint
Abstract: This article demonstrates how to build your own Business Connectivity Services (BCS) SharePoint 2010 components, "connectors"
They call me the “Connector guy”- affectionately of course- where I work, because I am like a Business Connectivity Services (BCS) machine when it comes to crunching out connectors to legacy systems. So I thought I would take the time to help others get over the learning curve of leaning to use BCS.
After reading this article, I hope you will agree that creating External list to data is just a walk in the park-like most tasks developers do, when they get the hang of it. The following chart is a good reference and depicts nicely that many tasks can be performed using the BCS architecture. In fact, almost any tasks can be performed using simple lists exposed by Business Connectivity Services (BCS) Services. In fact, “Everything is a list”, is one of my popular sayings.
Original Image Source
So if everything is a list, then let’s get started building some lists!
Note: I am going to assume that you have a development environment set up- probably on a virtual machine, and that you have an instance of SharePoint 2010 on that machine. Microsoft has simplified the development process greatly, but requires a lot of software installed as a prerequisite to getting started with SharePoint development. Ah, the pains of being a Microsoft developer!
Anyway, fire up VS 2010 and select File, New, and Project from the file menu. Again, Microsoft has done a nice job of creating templates for a lot of the SharePoint objects required to be successful in this environment- and yes, there is a BCS Template:
After selecting Business Data Connectivity Model from the SharePoint 2010 list and naming the project whatever you want, you will and up with the good, start towards creating a connector that will be exposed as a list on your SharePoint site:
I know what you’re thinking. This looks like any other template, with very little functionality and a lot of work to get it in shape to work in a real-world environment. Am I right? Well, your thinking is correct, but that is the reason I am writing this article. I thought the same thing, and as it turns out there a lot of little nuances in creating a “good connector”, and I will show the best way that I have found- and you can modify my model to fit your style.
Note: I think you will find using BCS, that taking small steps is going to prove to be a better strategy then plowing through all the steps and getting to the end, only to have a connector that is throwing errors and not being able to figure out how to fix them-(The correlation id problem- more on that later.)
So here is the first small step: Let’s rebuild the solution and deploy it to SharePoint - we will find out many things from this simple task:
1. Will the project compile without error?
2. Will it deploy to SharePoint?
3. Can we set the appropriate security settings on our BCS Component?
4. Can we create an External list in SharePoint using this BCS Component?
If all the steps go well and run without error, then we will be able to begin creating custom BCS components. The steps are as follows
Step 1 - Rebuild the solution
Step 2 - Deploy the solution
Step 3 - Set the permissions
Step 4 - Create External List in SharePoint 2010
Step 5 - Preview the list
Let us explore these steps in details:
Step 1: Rebuild the Solution
Select build rebuild solution from the File menu
Step 2: Deploy the Solution
Select build deploy from the File menu
Step 3: Set the permissions
Open SharePoint Central Administration (http://yoursite:8080) in most cases
Click on application management > manage service applications > Business Data Connectivity Service and find Entity1 from the list- this is the entity that we just deployed
Click on Entity1 and you should see this screen:
Click on set object permissions and give the appropriate rights to those who will be viewing the list
Step 4: Create the external list
Go to the main SharePoint site (http://yoursite) and click on site actions > view all site content > create, external list > create
Click the second icon from the External Content Type and select Entity1 from the pop-up:
Select create and your list will be created
Step 5: Preview the list
Congratulation, you’re on your way to becoming the “connector guy/girl” at your company. Of course this connector doesn’t do much, but we have fulfilled all the steps required to our ultimate goal of making “everything is a list”. If you have gotten this far, and you are looking at the list we created above, then all the obstacles have been cleared to creating your own, more powerful connectors!
Part 2 Creating Custom BCS Components
Part 1 of this series put us in a position to start building our own BCS SharePoint 2010 components, “connectors” and Part 2 will show you how to create powerful custom connectors that are connected to a database-so look out for Article 2 in this series.
Update: Part 2 of this article can be viewed here Mastering Business Connectivity Services in SharePoint 2010 (Part 2)