Before looking into what’s new
in BCS for SharePoint 2013, let’s do a quick level-set on the external
content type (ECT), a key component in Business Connectivity Services.
The ECT is metadata that describes the connection information, methods (create, read, update, delete)
that can be performed against the connection, data definitions for data
elements, and any parameters that might pass between the client and
external LOB data source. Security permissions can be set on the ECT to
allow access by specific users or groups, and a wide array of
authentication methods are supported, including Windows, claims-based,
username and password, and certificate. ECTs serve as the basis for
external lists. Unlike other lists in SharePoint that have their data
stored in the SharePoint content database, external lists retrieve
their data from the LOB data source every time the list is accessed by
a user or programmatically. Therefore, external lists bring real-time
data to SharePoint stakeholders. ECTs can also be made available to
SharePoint search for indexing, and the LOB system data is included in
a user’s search result, trimmed by permissions.
A significant benefit of BCS is that it can
provide a central location where IT manages a consistent approach for
accessing LOB systems. By investing in building ECTs on a common
infrastructure that surfaces LOB information in a usable and reusable
form, business users, power users, and developers alike can become
consumers of data served up by the ECTs in a variety of contexts. These
range from configuring a dashboard of business data Web parts on a
page, to configuring document templates for Word to include business
data columns, to developers building custom enterprise solutions. Also,
the developer’s’ programming pattern is consistent when building
against ECTs because no matter what the LOB system is, they code
exactly the same way against the ECT to retrieve or update the data.
Because IT also builds the ECTs, it can ensure the efficiency of the
ECT by defining the filters and throttling limits on the accesses to
the back-end systems.
External content types were broadly welcomed in
SharePoint 2010, and Microsoft built on the ECT foundation in
SharePoint 2013 by providing new capabilities. Figure 1 shows the various BCS components and highlights the primary Microsoft BCS investments in this release.
In the connector framework, alongside the
already-popular SQL, WCF, and .NET connectors, the new highly requested
OData connector joins the ranks. With the proliferation of OData
producers, services that expose their data using the OData protocol,
this new class of data services is now available for your BCS solutions.
With the new app model for SharePoint, where apps
have a particular scope upon install into SharePoint, BCS now has
app-scoped ECTs, too. In other words, an ECT can be created for and
deployed within the scope of the app upon install. Typically, where an
ECT has a farm-level, on-premises, or tenant-wide scope in Office 365,
your app for SharePoint can have ECTs in your solution that run
isolated within the app boundaries.
Another much-desired capability for BCS external
lists was to have REST support for accessing them. This feature, too,
was a significant investment by Microsoft to make the BCS data
available via REST, but it has done so while also making meaningful
contributions in the CSOM for accessing BCS data.
Microsoft also made significant investments in
this release to support alerts and event receivers on external lists;
both highly requested features by users and developers. Users can now
create alerts in external lists in the same way they do on other
SharePoint lists. Event receivers have been available on SharePoint
artifacts for some time, but now BCS is a first-class citizen in the
event infrastructure. For SharePoint to be notified that data has
changed on an external list, configuration both on SharePoint and the
external data source is required. The data source needs a way to become
aware of underlying data changes; for example, SQL triggers or a
service that periodically polls the data source to detect changes. It
also needs a way for SharePoint to subscribe to it to receive
notification of changes. SharePoint now has the infrastructure to
support this interaction and provides a way to register this
“notification channel” through an extension to the BDC model schema to
include the new EventSubscriber and EventUnsubscriber
stereotypes. At a high level, the communication flow for SharePoint to
subscribe to be notified when there is a data change on the external
system works like this: when the Subscribe method is called on the ECT associated with an external system, the Subscribe
method passes the event type and delivery address to the external
system. The external system records this information in a database and
then returns a subscription ID to SharePoint. When the Subscribe
method completes, notification of a data change can be sent from the
external system to the delivery address REST endpoint on SharePoint.
Receipt of the notification, in turn, fires an event on the external
list and calls into your remote event receiver. Please refer to MSDN
for full documentation on this subject.
Of the numerous Microsoft investments for BCS in
2013, let’s first take a look at setting up an ECT that connects to an
OData service. You will use Office 365 SharePoint Online in this Try It
Out since it supports Business Connectivity Services.
TRY IT OUT: Adding a Business Data Connectivity Model to Office 365 SharePoint Online (Employee.bdcm)
In this exercise you upload a Business
Data Connectivity Model (BDCM) file to Office 365 SharePoint Online
that defines an OData connection to the OData Northwind service
endpoint available on Odata.org.
After the external content type is created you then create an external
list in a site collection of your choice. This ECT is available tenancy
wide. For this exercise you will need an Office 365 Developer Site or
an Office 365 Enterprise Preview trial. Visit either http://on both dev.office.com to sign up for a Developer Site or http://on both office.com/preview for an Office 365 Enterprise Preview trial.
1. Log in to the Office 365 portal.microsoftonline.com site using an account with administrative rights on the tenancy.
2. From the Dashboard page, click Service Settings.
3. On the Service Settings page, click Sites.
4. On the Sites page, click the link following the question, “Don’t see what you are looking for?”
5. On the SharePoint Administration Center page, click BCS.
6. On the BCS
page, click Manage BDC Models and External Content Types. (In an
on-premises installation you would use the SharePoint Central
Administration portal and navigate to Application Management ⇒ Manage
service applications and Business Connectivity Service.)
7. Click the Import icon in the ribbon and browse to the Employee.bdcm
file . Click Open and click
Import. The BDCM file will be validated on import; when it has
successfully completed, click OK. (If you do not have permissions to
import, click Set Metadata Store Permissions and make sure you have
administrator-level permissions on the Metadata store.)
8. In the ribbon, click the drop-down list to select different views of the BDC Metadata Store and select BDC Models. Click the
NorthwindModel check box, and as shown in Figure 2, click the Set Object Permissions button in the ribbon.
9. Browse the
directory to find and select your user account, and then click the Add
button. While your user account is selected in the lower window, click
all the check boxes under Permissions to enable the full set of
permissions, and then click OK. This gives your account full rights to
manage the BDC Model.
10. In the
ribbon, click the drop-down list to select different views of the BDC
Metadata Store and select External Content Types. Click the Employee
check box and click the Set Object Permissions button in the ribbon.
11. Browse the
directory to find and select your user account, and then click the Add
button. While your user account is selected in the lower window, click
all the check boxes under Permissions to enable the full set of
permissions for your account to access and manage the ECT. Click the
check box to Propagate permissions to all methods and click OK.
12. Navigate
to any site collection in your Office 365 tenancy where you want to
create an external list for the ECT. When in the site collection, click
Site Contents and select Add an app.
13. Scroll through the apps until you can see the External List tile as shown in Figure 3. Click it to add an External List.
14. In the Adding External List dialog, enter Northwind Employees for the name and click the Select External Content Type icon.
15. In the External Content Type Picker, select the Employee external content type, click OK and the result should look like Figure 4. Then click Create.
16. On the
Site Contents page scroll until you see the new Northwind Employees
app. Click the tile to open the external list. Additionally, a link to
the Northwind Employees external list has been added in the left
navigation bar under Lists. The completed external list should look
something like Figure 5.
How It Works
In this example, the .bdcm
file was already created for you to simply see the pattern for how to
wire up the model in the administration portal. This is one pattern you
can follow if you already have ECTs in your SharePoint 2010 environment
and you want to move them to your 2013 environment. You can export them
from 2010 and import them into 2013. For Office 365 SharePoint Online,
only BDCMs that are SOAP-based or OData-based connections are supported
— no .NET or ADO.NET (SQL direct connections) can be used in SharePoint
Online. Also, the SOAP and OData ECTs can only use group-based
permissions with authentication managed via the Secure Store Service
(SSS).
If you navigate to the Employee.bdcm
provided and open it in
Notepad or any XML editor, you can view the XML document structure.
Following are a few of the high-level elements with which you should be
familiar:
- LobSystem: This describes the type of connection (DotNetAssembly, Database, Webservice, or OData) to the external data source.
- LobSystemInstance: This describes the specific implementation of the LobSystem; with this element you can see the metadata describing the service URL endpoint and data format.
- Entity: This describes the business entity or object. It contains both Methods and data definitions described in a collection of Parameters.
- Method: This represents the read-write capabilities for the Entity. At a minimum a method of the type SpecificFinder that will return one item, and a Finder that will return all items must exist. These two methods are required for an ECT. Methods of the type Updater, Deleter, and Creator
are optional depending on whether your external data source allows
them. Or even if the external data source does have methods available
beyond Finder and SpecificFinder,
you choose which methods you want to implement in your ECT. Through the
ECT creation process using the SharePoint Designer wizard or in Visual
Studio, you create the mappings for the methods you want to expose in
your ECT to the corresponding methods in the external data source.
Lastly, methods can be scoped using a FilterDescriptor.
- Parameter: This describes the data elements that will flow to and from the external system.