Using SharePoint Designer with External Content
Using Visual Studio 2010 with the BCS
TRADITIONALLY, Microsoft SharePoint stores data in lists and libraries; however, most organizations do not want to move all their data into SharePoint—nor should they. Most organizations have spent time and money to build or purchase specialized systems, such as Siebel, CRM, and SAP to assist with key business processes. Understandably, it makes sense to integrate the data from those external systems into SharePoint sites and applications, such as Microsoft Outlook 2010, Microsoft Access 2010 and Microsoft Workspace 2010 with an easy-to-use interface.
Using SharePoint Designer 2007 and Windows SharePoint Services 3.0, it was possible to connect to external content by using the Data Source Library task pane. This method is still available with SharePoint Designer 2010 and SharePoint Foundation 2010, but it is now known as the Data Sources gallery. However, in addition to this method of connecting to external content, in SharePoint Foundation, you can now use an enhanced version of functionality that was originally available only with the Enterprise Edition of Microsoft Office SharePoint Server 2007. It was then called the Business Data Catalog; now it is exposed as a service application called the Business Connectivity Service (BCS).
The BCS centrally stores the definition of the external content—both its location, the type of data it is, and the behavior of the data when it is integrated into SharePoint and Microsoft Office client applications—in the Business Data Connectivity (BDC) metadata store. The definition of the external content is known as the external content type (ECT). The definition of the location of the external system together with the ECT is known as the BDC model. Once an ECT is defined, then by using the browser or SharePoint Designer, you can manipulate the data from the external system similarly to other SharePoint objects, such as lists and Web Parts via a new list type to SharePoint Foundation, called the External list.
In this chapter, you will learn how to use the Data Source gallery and the BCS. You will also look at the differences between the two methods. You will look at the architecture of the BCS, including the security options. Then, you will look at managing the data connections and how to expose the data from the external systems on webpages and in lists and libraries. Finally, you will learn how use Microsoft Visual Studio 2010 with BCS.
Using Microsoft FrontPage 2003, and then later SharePoint Designer, it has always been possible to connect and present data from several types of external data sources. For each site, you can specify the location and connection query to external data sources. For example, in SharePoint Designer, open the site in which you want to present the data, and then in the Navigation pane, click Data Sources. The Data Sources gallery appears in the SharePoint Designer workspace, as shown in Figure 9-1, where each data source is grouped by data source type.
Table 9-1 describes the variety of data sources that can be used by SharePoint Designer to connect to external content.
Table 9-1. Data Source Types
To create a new data source definition, either click in the Data Source gallery or click the icon to the left of an existing data source to activate the commands on the Data Sources ribbon tab. Then click the appropriate data source type in the New group to display the Data Source Properties dialog box, as shown in Figure 9-2.
Figure 9-2. Use the Data Source Properties dialog box to define the location and data that you want to be returned from the external system.
This dialog box can contain up to three tabs:
General Use this tab to give the data source definition a meaningful name. SharePoint Designer creates a name for the data source definition if you do not provide one.
Source This tab contains different options, depending on the data source type. For the database connections data source type, the Source tab contains one button, the Configure Database Connection, which when clicked opens the Configure Database Connection Wizard, in which you specify the server where the database is located, the provider name, and credentials that will be used to access the database. Alternatively, you can provide your own custom connection string. If you are not connecting to an SQL server, then the second page of the wizard allows you to select the table or view or specify custom Select, Update, Insert, and Delete commands using SQL or stored procedures.
Login Use this tab to define the authentication method by which you connect to the external system. The Login tab on the Data Source Properties dialog box for the Database Connection data source is not displayed; however, you are asked which authentication method you want to use once you click the Configure Database Connection button. You need to consider carefully the authentication method used to connect to the external systems, because this has security and infrastructure implications. The three methods that you can use with most data source definitions are:
Don’t Attempt To Authenticate This is equivalent to anonymous access.
Save This Username And Password In The Data Connection The user name and password is transmitted over the network in clear text. An attacker can possibly compromise this authentication option. You should ensure that your infrastructure is configured appropriately for the sensitivity of the external content, for example, by using Kerberos, Secure Sockets Layer (SSL), or Internet Protocol Security (IPsec).
Use Windows Authentication The user’s authentication information is passed by SharePoint to the external system. This mode always incurs a double hop unless SharePoint Foundation 2010 and the external system are installed on the same server, which usually only occurs in small organizations or in larger organizations in a development, prototyping, or demonstration environment. Then, the user’s identity has to make only the one hop from the user’s computer to the SharePoint server. In most installations, when the external system and SharePoint Foundation are installed on different servers, SharePoint cannot pass the user’s identity to the external system (the second hop). The workaround is to use Kerberos or SSL with this authentication method.
For more information about the double-hop issue, go to http://blogs.msdn.com/b/knowledgecast/archive/2007/01/31/the-double-hop-problem.aspx.
INSIDE OUT Where are the data source definitions stored?
The details of the data source definitions that you create are stored in Universal Data Connection (UDC) version 1 file format in XML files in a hidden library, fpdatasources, in the _catalog folder. Users who can see the hidden URL site structure when using SharePoint Designer can view this library and the _catalog folder. SharePoint Designer creates the fpdatasources library when the first data source definition for a site is created. For the data source definitions that are dynamically created for lists, libraries, and XML files that are in the root of the site or in the Site Assets library, no XML file will exist. However, if you copy one of these automatic data source definitions, then an XML file will be created. You can copy a data source definition by using the Copy And Modify command in the Actions group of the Data Sources ribbon tab.
Once the external content connection is defined in the Data Source gallery, then these definitions can be used with the Data Form Web Parts to display the content. When a Data Form Web Part is used to display the external data, a copy of the data source definitions are placed into the Data Form Web Part’s XSLT code. If you update the definition in the Data Source gallery, the definition stored in the Data Form Web Part is not updated.
For more information about the Data Form Web Part, see Chapter 7. You can find more information about how to use the Data Source gallery in the book, Microsoft SharePoint Designer 2010 Step by Step, by Penelope Coventry (Microsoft Press).