External content types (ECTs) are the
linchpin for bridging connectivity between external data sources and
SharePoint. Similar to regular content types in SharePoint ,
external content types represent an entity or classification of an
object in your solution. An external content type contains fields,
which are the attributes of the entity. If you have a background in
software development, you may consider external content types analogous
to code classes—classes describe objects, which are the concrete
instances of a class.
Most content in SharePoint centralizes in
content types because they represent a discrete portable entity in the
SharePoint farm, which content owners may apply in different
situations. Publishing, records management, document management,
business intelligence, collaboration lists and libraries—they all
leverage content types at the core to describe data schema in
SharePoint. External content types integrate and operate in a similar
fashion to that of internal content types, except that they describe
entities of external data. For example, if you are aggregating
personnel records from an external HR system, you might define an
external content type that represents an employee, with fields for
names, office location, and any other attribute of the employee.
The Business Connectivity Services Application page, will display external content types after you define them. To define a
new external content type, you must use SharePoint Designer. The
following steps demonstrate creation of an external content type, which
represents an employee from an Adventure Works SQL database:
Note Download the Adventure Works DW database for your version of SQL Server at the following location: http://msftdbprodsamples.codeplex.com/.
- Open SharePoint Designer 2013 (SharePoint Designer 2013 is a free download: http://www.microsoft.com/en-us/download/details.aspx?id=30346).
- Open your SharePoint 2013 site.
- From the left navigation, click the External Content Types link, under the Site Objects left pane (see Figure 1).
- SharePoint Designer will show you any external content types you
have in the site collection. In my case, I have none because I have not
yet defined any.
- Click the button for external content type in the new group within the ribbon.
- On the new External Content Type page, give it a name and display name; I called mine Employee.
- Set the Office Item type to the List type within SharePoint. I went with a generic list.
- Decide if you want offline sync, meaning that SharePoint will allow
you to read and update external data via cache when the external system
is offline.
- Click the link for the external system to discover your external system connection.
- You should see a page like that in Figure 2.
- Click the Add Connection button.
- Select the connection type. I chose SQL Server because I am demonstrating connection to the Adventure Works database.
- Provide the connection details in the dialog box, as shown in Figure 3.
- The dialog box for SQL Server database is not too helpful in that it will not enumerate the available databases for you.
- Choose the security method for the connection—here you can use a Secure Store connection, or identity of the logged in user, or the impersonated user identity.
- Choose Connect with Impersonated Windows Identity and provide the
application ID from the Secure Store (default is to use the User’s
Identity, as shown).
- Click OK and provide the credentials you entered in the Secure Store.
- You should see the connection to the data source created (Figure 4).
- Expand the views node and right-click on the view for Employee.
- You should see a list of operations to create—these are the Create,
Read, Update, and Delete (CRUD) operations, used by SharePoint to
access your data entity via the external content type—I chose all
operations, to make life simple.
- SharePoint Designer shows a wizard to configure the operations.
- Click the Next button to configure the parameters for the entity (Figure 5). Here you get to choose the columns from the view and how they map to the external content type entity.
- Click the E-mail Address column and then check the check box to map this field as an identifier.
- Check the check box to show this column in the picker; this allows
you to show values of this column in picker dialogs for choosing a
specific entity.
- Check the check box to show the value in picker dialogs for job title, last name, and first name columns.
- The last page of the wizard shows the filter options that SharePoint Designer recommends for the data source (Figure 6).
- Click the button to add a new filter.
- Change the Data Source Element to the E-mail Address column.
- Click the link to add the filter.
- In the filter dialog, change the type to Limit and then click the OK button.
- Enter the value 1000 in the Default Value.
- Click the Finish button.
Note The wizard shows verbose warningand error
messages for correct configuration of your external content
type—SharePoint Designer disables the Finish button until you remedy
all errors.
- On the External Content Type details page, click the E-mail Address column in the Fields box.
- Click the Set as Title icon on the ribbon.
At this point, you should have an external
content type—I named mine Employee—some CRUD operations, and a limit of
1000 items returned. If you switch back to Central Administration and
view the Business Connectivity Services Management page (Figure 7), you should see your external content type in the list.