Sharepoint 2010 Business Connectivity Services Examples


Business Connectivity Services Step by Step Tutorial in Sharepoint 2010 or 2013with Example

  • In this tutorial of sharepoint 2010 or 2013 i will explain BCS (Business Connectivity Services)
  • BCS is actually a platform that provides a SharePoint-based framework for creating composite applications
  • This composite applications  are built by combining services and functionality from other enterprise applications to address the collaborative needs of users.
  • These composite applications use the Office client user interface in addition to the functionality of the application. 
  • This helps people perform their tasks within the familiar user interface of the Office and SharePoint Server systems, 
  • BCS allows people to take actions and make decisions within the context of the problem at hand
  • In this tutorial we are using AdventureWorks sample database in SQL Server 2008 or 2008 R2
Lets now begin the step by step tutorial in sharepoint 2010

STEP 1:
  • First  you have  to check whether  the Business Connectivity Service running in SharePoint Central Administration.
  • Now Open SharePoint Central Administration and Click Application Management in the Quick Launch
  • From the  Service Applications section select the Manage Service Applications hyperlink. and locate Business Connectivity Service. and check if the status to check whether the service is started or not
STEP 2:
  • Open SharePoint Designer 2010.and from  left pane choose the External Content Types collection. 
  • The designer will take some time to load all necessary data 
  • Click the External Content Type button in the New group on the ribbon.
  • Click on the New External Content Type hyperlink next to Name. Give your content type a name like Contacts.
  • SharePoint Designer presents you a form where you have to fill out some information before the external content type can be created.
  • This name will automatically be taken over for the display name but you can change it if you want.
  • Set the namespace to 20Fingers2Brains ..you can name it anything as you want.
  • Select Contact from the dropdown next to Office Item Type.
  • You can also decide whether the list can be taken offline or not. 
  • You can work with your SharePoint site offline using the SharePoint Workspace 2010 application, which is part of the Office client tools
  • An external content type exposes data from an external data source, like a SQL server table, in SharePoint 2010. You can create an external content type using SharePoint Designer 2010
  • It involves no code at all. In this example we are going to expose the Contacts table from the AdventureWorks SQL Server database into SharePoint 2010
STEP 3:
  • The next step is to define the data source to which you want to connect
  • Find the panel External Content Type Operations right under the External Content Type Information panel.

  • Click the hyperlink at the bottom of the panel.
  • Click the Add Connection button.
  • Choose SQL Server from the popup.Click the OK button.

STEP 4:
  • Expand the AdventureWorks treeview. Notice that you can choose between the different tables, views and routines.
  • Right-click the Contact table and notice all the different methods that can be associated with the external content type.
  • When the data source is defined you can start with the definition of the external content type. One of the things you will have to do is define the methods that will be associated with the external content type
  • Choose Create All Operations. This will create all the Finds, Updates and Delete methods.
  • A wizard opens where you will have to answer some questions.
  • Click the Next button.
  • In the next screen you will be able to define the mappings between the columns of the SQL Server table and the fields of the Contact table type. At the bottom you see a number of errors and warnings you need to address before you will be able to create the operations.
  • Select the LastName column of the SQL Server table and map it to the LastName column of the Contact table.
  • Check the Show in Picker check box.
  • In the Office Property dropdown it is indicated that a custom property will be created. Choose LastName from the dropdown.
  • Select the rowguid column of the SQL Server table. Make sure the Required check box is unchecked.
  • You can uncheck all other columns that you don’t want to show up in your external content type.
  • Leave all other columns as is.

STEP 5:
  • Click the Add Filter Parameter button. A new filter parameter is created.
  • Select the (Click to Add) hyperlink on the right of the screen. A dialog opens.
  • Choose Limit from the Filter Type dropdown and leave ContactID selected in the Filter Field dropdown. Click the OK button.
  • In the next screen of the wizard you are able to define a filter to avoid that too many data is returned to SharePoint.

  • Right under the filter in the Properties pane, set the Default Value to 100.
  • Click the Finish button to accept the changes.
  • Click the Save button to save the changes. It takes some time before the external content type is created.
  • On the ribbon you can see that you can do different things with this new external content type: you can edit the different operations, but you can also create a list and its forms for this external content type, and create a profile page.

STEP 6:
  • In the Business Connectivity Service you can check the external content types that are created. If you want to create profile pages for your external content types, you have to change a configuration setting of theBusiness Connectivity Service here.
  • Return toSharePoint Central Administration.
  • Click Application Management in the Quick Launch.
  • In the Service Applications section select the Manage Service Applications hyperlink.
  • Scroll down to locate and select the Business Connectivity Service.
  • You can see that the Contacts external content type is there.

  • Select the Edit button from the ribbon.
  • Select the Configure button.
  • The only thing to do in the wizard is to enter the URL to your SharePoint site,
  • Now you can select one of the external content types listed and choose Create/Upgrade Profile Page
  • This means that you can create profile pages from within Central Administration or in SharePoint Designer .

STEP 7
  • Now you are going to create a list based on the external content type you just created.
  • Open an internet browser and navigate to your SharePoint site.
  • Choose More Options from the Site Actions menu.
  • Select the Lists tab on the right.
  • Pick the External List template from the wizard and click the Create button.
  • This brings you to a familiar creation page where you can fill out the name of the new list. Give your list a name, like f.e. ECT Contacts.
  • In the Data source configuration section select the right picker button.
  • The External Content Type Picker opens. Choose your content type from the list and click the OK button

When the Contacts list is created, it opens in the All Items view. You can do all the things you can do with a native SharePoint list: select items, view items, edit items, define views,

Select an item and choose Edit.Change the phone number and save your changes.In SharePoint 2010 making changes to external data is much easier than in SharePoint 2007

Notice your change in the All Items view. But your changes are also saved back to the Contacts table in the AdventureWorks database. 

3 comments: