Business Connectivity Services and Data View Web Part

SharePoint’s Business Connectivity Service (BCS) is intended to provide SharePoint access to a variety of data sources to include:

  • SQL Server
  • .NET
  • WCF Service
  • SOAP
  • REST Service Connection
  • XML File Connection

Important things about Business Data Connectivity Service:

  • BCS are based on some predefined operations like Create, Read Item, Read List, Update and Delete.
  • It allows you to work directly with data stored in an external system or database.
  • Authentication can be done directly using User authentication or the SharePoint Secured Store Service can be used to authenticate with a specific account.
  • Information can be one-way (view only) or two-way (add, update & delete).
  • BCS data sources can be ‘associated’ to one another to create ‘relationships’ – One-to-Many, One-to-One, etc.
  • Connections can be made using SharePoint Designer (easiest) or through Visual Studio.
  • Its ‘definitions’ can be exported and imported across sites.
  • BCS is based on the “Business Data Catalog” and uses BDC definitions to access “line of business” (LOB) data.
Create a Data SourceOpen SQL and connect to the DEMO2010A Database:

 

DEMO2010A

Right click on Databases and select New Database.

Name the database DataSheet:

DataSheet

Click OK to create the database.

Right click on the Tables folder and select New Table.

Add columns in Table and then enter the table name. I entered “PersonalInfo” and save it.

PersonalInfo

Add data in your table.

DataTable

After that create the Table view and name the view. We can use table itself directly. Use views if data is taken using joins from multiple tables. I entered “PersonalInfoView”.

PersonalInfoView

CREATING THE EXTERNAL CONTENT TYPE

Open SharePoint Designer 2013 and connect to your site.

EXTERNALCONTENT

In the ribbon, click External Content Type:

External Content

The external content type will open in the ‘Summary View’ – click the name (New External Content Type) to change it to PersonalInfo:

Summary View

Next we need to select data source type that we want to use– click ‘Click here to discover external data sources and define operations’. This will open the Operations View:

external data sources

Click the Add Connection button then choose the Type as SQL Server and click OK:

Add Connection button

Then enter the database server name and name of the database and click OK:

server name

After the connection is validated, the database should appear in the Data Source:

connection

Right click on the view PersonalInfoView to generate operations (read, update, delete, etc.) For this demonstration, click Create All Operations – this will create all the operations.

Operations

On the Operation Properties page, click Next (if there are any errors, such as a read only table, they would be indicated here)

Operation Properties

On the Parameters Configuration page, you will need to define the Identifier for this table (Primary key to the table) – click ID and then click Map to Identifier:

Parameters Configuration

Click Finish to create the operations (if you click Next, you can specify filters for the data, i.e. a subset of the data in the database) – once these are created, you should see the operations listed under External Content Type Operations (right side of the page):

specify filters

Then Set one field as Title.

Set one field

Then generate the list and forms for the external content type (This will create the list in SharePoint. It is called External List) – in the left navigation bottom, right click on External content type then Create Lists:

External List

Add a list name in it:

list name

SETTINGS BDC PERMISSIONS

Now open the list in browser that created on the site. However, you do not have access yet since the BDC – you can ‘prove’ this by opening your site and open the list:

BDC List

Open the Central Administration site and from the home page under Application Management, click Manage Service Applications.

Click on the Business Data Connectivity to open it:

Business Data

You will find the BDC connection created. Select our BDC and then click Set Object Permissions at top ribbon:

BDC connection

Set the account and set the permissions and click OK:

account permissions

Same steps follow for Set Metadata Store Permissions.

Now browse the list from site:

Browse list

Create Page and Add Data View Web Part on it.

First create the page under site contents named “DataView”

DataView

Then Go to SharePoint designer Home > Site Pages

SharePoint designer

Edit the page in SharePoint Designer. Click on Insert tab from Top of ribbon and click Data View and select the external list “PersonalInfo”. It will add dataview web part on the page and bind this web part with external list. Save the page.

Data View

Now browse the page in browser. You will see that our External list content is showing up in page:

Page browser

Leave a comment