Article – Business Connectivity Services (BCS) Part III – Creating an External Content Type (ECT)
Here you get the long awaiting Part III of my BCS article series. Having discussed what BCS is, terminology and the solution types, it's time to create a simple solution. Let's create a simple solution which brings/ surfaces data coming from a SQL Server database within in a SharePoint site.
Scenario
Northwind has implemented an intranet portal using SharePoint Server 2010 and it is becoming very popular among the business users/ information workers. One of the business users has learnt about the powerful capabilities of SharePoint 2010 release in the area of integrating with legacy systems. He sends an official email to the IT department of Northwind inquiring about the possibility of integrating their LOB system with SharePoint so that they can manage their Contacts, Prospects, Leads, etc… efficiently using their intranet postal interface.
Solution
IT Manager has realized the importance of the request and now he needs to deliver the solution using BCS which is part of SharePoint 2010. IT Manager decided to develop a simple solution using SharePoint Designer 2010 to make it simple and fast for both business users and the developers.
I navigated to SQL Server Management Studio (Start -> All Programs -> Microsoft SQL Server 2008 R2 -> SQL Server Management Studio) and expanded the Databases node. I further expanded the Northwind database and its Tables folder to see all the tables available.
As the 1st step, I decided to provide access to Employees data available in Northwind database using SharePoint 2010 site. I executed the following SQL statement to see all the data available in the Employee table:
Let's develop our 1st BCS solution to integrate Employees data into a SharePoint 2010 site.
Exercise 1 – Creating an External Content Type (ECT)
- Fire-up SharePoint Designer 2010 by navigating to Start -> All Programs -> SharePoint -> Microsoft SharePoint Designer 2010.
- Click Open Site to bring up Open Site dialog box.
- Enter the URL of the SharePoint site for Site name: and click Open.
- Select the External Content Types from the Site Objects pane and wait until it retrieves all the existing External Content Types.
- Select the right-side panel to activate the Ribbon menu options and click the External Content Type from the New group in the ribbon.
- You will get the New external content type tab/ page and that's where you will configure your External Content Type to communicate with the Northwind database.
- Let's first fill the details for the External Content Type Information section. Place cursor for the Name and provide a meaningful name for the External Content Type.
- Press Tab to navigate to next field and you will see Display Name is populated automatically based on the Name field. Place the cursor and change the Display Name if you wish. I gave a space in-between to read as "Northwind Employees" which is easy to read.
- Select an appropriate option for the Office Item Type. If you are planning to surface data within Office applications such as Outlook you need to specify the Office Item Type. If you have no plan to surface data inside Office applications you can keep the default value which is Generic List for the Office Item Type. You can use Appointment as the Office Item Type if the underlying data coming from the LOB system need be shown in the Calendar pane in Outlook. If you are brining data which can be shown in the Contacts pane in the Outlook such as Employees, Customers, Students, Dealers, etc… then you can use Contact as the Office Item Type.
- For this demo select the Contact as the Office Item Type.
- Next select whether you want to have the Offline Sync for external list Enabled or Disabled. For this demo, keep the default value which is Enabled.
- After finishing the defining External Content Type Information, your screen will look something similar to the following.
Exercise 2 – Defining External Content Type Operations
- Click the link Click here to discover external data sources and define operations link in the External Content Types Operations section to define the external system information and the operations.
- You will be taken to the Operations Designer for the Northwind Employees External Content Type. Click the Add Connection button to bring the External Data Source Type Selection dialog box.
- Select SQL Server as the Data Source Type and click OK to bring up the SQL Server Connection dialog box.
-
Fill up the SQL Server Connection dialog box as shown below by providing Connection Properties and click OK:
- Database Server: - provide the name of the SQL Server. In my case, I'm providing (local) since the database is hosted in my local machine.
- Database Name: - provide the name of the database. In this demo we are connecting to Northwind database.
-
Authentication – select what authentication mode to be used. Select Connect with User's Identity for this demo and other options for this are:
- Connect with User's Identity – this will take the currently logged-on user's identity for the authenticating to the external system.
- Connect with Impersonated Windows Identity – this allows us to have a common windows account setup for authenticating to the external system and all the requests goes through this account just like using a Service Account.
- Connect with Impersonated Custom Identity – this helps us to setup Secure Store Services (SSS) and configure Single-Sign-On to authenticate to the external system. With SSS, we can create and configure different Secure Store Target Applications and map the login credentials between SharePoint and the external system. If we are going to this option, make sure to create and configure the Secure Store Target Application beforehand and provide the Target Application ID for the Secure Store Application ID: field.
- Data Source Explorer will show up Northwind data source and expand it to see all 03 possible way of communicating with the external system:
- Tables – allows us to directly connect with a table object in SQL Server.
- View – allows us to connect with a view instead of a table.
- Routines – allows us to connect with a Stored Procedure in SQL Server instead of a table.
- Expand the Tables node and then you will see all the tables from the Northwind database. Expand Employees table and then Columns node to see how SharePoint Designer 2010 has retrieved schema information from the underlying database system.
- Right-click the Employees table and select Create All Operations to fire up the All Operations wizard. This wizard will guide us on configuring what information we need to bring to SharePoint and how they get mapped to Office properties if we have decided to do so, etc… If you don't wish to provide all the CRUD-Create, Read, Update, Delete operations to the external system through SharePoint, you need to select the appropriate options from the below screen. If you want to provide only the Read operations, generate only Read Item and Read List operations.
- Click Next in the welcome page of the All Operations wizard.
- Parameters Configuration page will show up next and as the 1st step we need to select what are the columns we need to bring into SharePoint. Best practice is to avoid all the optional data fields and select only the mandatory fields to minimize the performance issues. As you can see below, I have selected the fields which are interest to my demo and make sure you double-check with your requirement.
- Next we need to setup properties for each column and select the column from the left-side Data Source Elements pane and set the properties from the right-side Properties pane. Select the LastName from the Data Source Elements and change the Display Name:, Office Property: & Show In Picker: properties.
- Repeat the same for the rest of the fields except selecting the option Show In Picker:. Leave Show In Picker: as unchecked.
- Click Next to bring up the Filter Parameters Configuration page. Click Add Filter Parameter to add a filter.
- As a best practice, we will add a Limit filter to limit the no of records travels from the external system to SharePoint. Select the newly added filter from the left-hand side Filter Parameters pane and click (Click to Add) from the Properties pane to configure the Filter:. This will brings up the Filter Configuration dialog box. Provide a name for the New Filter field. Select Limit for the Filter Type: and click OK.
- Once you are back in the Filter Parameter Configuration screen, give a value to Default Value: to provide a default value to the Limit filter and press Tab. I gave 100 and you can provide a reasonable value.
- Next, let's add a Wildcard filter parameter to provide users with wildcard searching capability against Last Name value. Click Add Filter Parameter button again and select the LastName for the Data Source Element: from the Properties pane. Click (Click to Add) link to configure the Filter:. Configure the Filter: as shown in the following screen and click OK.
- Click Finish to finish the Filter Parameter Configuration wizard.
- When you are back in Operation Designer, you can see External Content Type Operations section has 05 operations generated for us to use.
- Click Save to save the External Content Type to the Site Collection.
- Verify that the new External Content Type is created by navigating back to External Content Types form the Site Objects pane.
Now that we have created and configured our External Content Type to communicate with Employee data in Northwind database in SQL Server and we are ready to integrate it with SharePoint 2010 site.
In my next article, I will discuss the process of creating an External List and how to surface Employee data within SharePoint site coming via NorthwindEmployees External Content Type.

























June 21st, 2011 - 23:25
Great article!
Here you find another solution using secure store services with SAP und ERPConnect:
http://www.parago.de/2011/04/how-to-use-sharepoint-2010-secure-store-as-single-sign-on-service-for-sap-applications-using-erpconnect/