Tuesday, May 29, 2012

Business connectivity services

BCS is one of great feature in SharePoint platform that integrates SharePoint solution based application to external system. In this article, I illustrates  a step-by-step procedure that how to connect SharePoint application to external system,  how to create an external content type using SharePoint designer as well visual studio  and in which and where we have to use visual studio for developing external content type .

External content type which is a fundamental block of BCS and describes how to connect external system from SharePoint by using metadata in the xml program. For those familiar with SharePoint 2007 BDC, it was called as BDC entity and they can understand the pain of creating external content type in SharePoint 2007 environment .But, in SharePoint 2010 it is very easy and straight forward to create external content type from SharePoint designer. But in some situation we couldn’t use SPD for creating external type such as calling complex data type , calling multiple external system and calling one external system and writing output to another external system .In the remaining of article I will explain more elaborately .Let us take a look how to create external content type from SPD 2010

How to create external content type from SPD 2010

This is a great starting point for who are newly introduced to BCS and Information knowledge worker.
Open SharePoint designer 2010 from desktop and enter your site url where you want to show the external system data .Click external content type in the site objects window, and then  click External Content Type link under external content type menu 

I hope that you are in the same window .After click New external content type menu, you can view see same window with your new external content type properties that content type display name,name,version and etc.

After change external content type display name and name as meaningful, Click “Click here to discover external data sources and define operation” link under external content type information box, which navigate you to new screen same as below.

This is the place where we are going to create an external data source connection. Click Add connection button and then select your data source type i.e. in which platform based application do you want to connect , in this example, I am using sql server as a data source . Once select your data source type, click OK.

It will pop-up a data connection properties screen and enter your database server, database name and select  authentication identity option button which talks to external system during connection time  and pass the credential depends on your selection in the window then Click OK button.

Once successfully configured connection, you can view your external source data inside data source explorer box.

Right click your table; it will pop –up menu looks like below screen and click “create all operations” option. It takes you to   all operation screen and then click next button.

After click Next button, you are in parameter configuration screen same as below screen with your table properties.

In the errors and warnings box, you can see all errors and warning message. In our window also, you can see an error message that “At least one identifier should be specified”. Yes, we have to set one field property as a map to identifier .Here, I have set it map to identifier property to Customer id field. After setting map to identifier property, you can see that error message goes off from the error and warning box and then Click Finish button and save your content type. Finally, we create our new external content type successfully.
Now, we have to create an external list to display our external data on our site .They are two ways to create external list, one is from SPD and another one is directly from site. In my example, I am creating an external list from SharePoint site.
Before going to create an external list, just check that our external content type has been successfully and external content type was imported in the central administrator. For checking in central admin, Open your central admin, click “manage service application” under application management and then select your BCS application services which will navigate you to external application service information page, here, you can see your external content type .


Now we ensure that our external content type has been imported and resided under central admin. Let us go to our site view all site setting page, click create link and choose “External List” list type from list category.

After creation of external list, you will be in the same as below screen.

In this screen ,you enter your list name ,quick launch menu option and at the end select your external content type which we has been created and imported on the central admin .If you have confusion while selecting your content type .Please follow below screen numerical notation .Select your external content type , Click create button .
Now, you can see your external list with your external system data .Some time, you may see the famous error that “Access denied by Business Data Connectivity”. The reason of the issue is that you don’t have sufficient permission to access the external system data. Go to Central admin where your external content type file was imported.

Select your external content type check option and click “Set Metadata Store Permission” .you can find that no one user account has been configured for permission .Add your credentials and select all permission check box then click Ok button.
Now, Go to your external list and refresh .Right now, your external system data will be listed on your external list but at the end we will achieve our goal.
Let us check our functionality, Add a new item in the external list, it will automatically reflect on your external system same as vice versa.
It is working perfectly fine .I hope you enjoyed and learned new feature ;)
I’ll explain you in my next article that how to create external content using Visual studio 2010.