Create External Content Type based on SharePoint Lists


Introduction:

Business Connectivity Services (BCS) is a new service introduced with SharePoint 2010 to allow SharePoint sites to connect to and manipulate external data. SharePoint 2007 had a similar facility in the form of Business Data Catalog (BDC) which made external data available within its site. However, a major problem with BDC was the difficulty in creating solutions as there was no support in the 2007 designer.  Most BDC solutions were simply for accessing external data, manipulating external data sources was extremely difficult.

With SharePoint 2010, BCS ships with out-of-box features such as solutions, services, and tools which make connecting to external data an easy task. Whether you want to retrieve Outlook contacts in a list offline or edit the contents of your document file or share your excel sheet online or reuse data from dynamic InfoPath forms or just update your business presentation, BCS enables deep content sharing, editing and integration in SharePoint 2010 with SharePoint Designer and Visual Studio tools.

Description

SharePoint 2010 out-of-the-box exposes list data as OData feed. Here we will be consuming the OData feeds using Business Connectivity Services. We can retrieve the list data by the URL http://serverName:1111/_vti_bin/listdata.svc. We will be adding the service reference to the OData feed and will be generating the code in Visual Studio 2010. The following example shows how to create External Content Type based on SharePoint list. I have created a custom list named "Customers" which has the following data's.


Prerequisites

  • Microsoft SharePoint Server 2010 or Microsoft SharePoint Foundation 2010 installed on the server

  • Microsoft .NET Framework 3.5 and Microsoft Visual Studio 2010


Example

Create SharePoint Solution based on Business Data Connectivity Model template:

  • Open Visual Studio 2010.

  • Go to File => New => Project.

  • In the New Project dialog box, expand the SharePoint node, and then select the 2010 node.

  • In the Templates pane, select Business Connectivity Catalog Model.

  • Enter the Name and then click OK.


The SharePoint Customization Wizard appears.

  • In the What local site do you want to use for debugging page, type the URL of the SharePoint Web site you will use to test the model, and then click Finish.