Chapter 9. Working with External Content

Using SharePoint Designer with External Content

Using the BCS

Presenting External Content

Using Visual Studio 2010 with the BCS

Summary

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 SharePoint Designer with External Content

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.

Data source connections displayed in the Data Sources gallery.

Figure 9-1. Data source connections displayed in the Data Sources gallery.

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

Data source types

Description

SharePoint lists and libraries

Every list and library is automatically listed in the Data Source gallery. Those lists and libraries that have the hidden property enabled are not shown. Therefore, libraries, such as the Master Page gallery, List Template gallery, the Theme gallery, and the Web Part gallery are not displayed in the Data Sources gallery.

External lists

Although you cannot create External lists from the Data Sources gallery, External lists are displayed in the gallery. More information on External lists and ECTs is provided later in this chapter.

Database connections

When you first open the Data Source gallery, there are no connections to any databases. You can create connections to a variety of databases that reside on Microsoft SQL Server 2000 or later version, or to any data source that uses the OLE DB protocols, such as MySQL. You can create multiple data sources to the same database, each using a different table, view, or query.

SOAP services

A SOAP service is a special site that can return XML in response to a procedural query. SharePoint itself exposes its data as a SOAP service, with which you can create, for example, a list of announcements from the current site and its child sites, known as a rollup of announcements.

REST services

Similar to SOAP services, where data can be retrieved from a data source as XML data.

RSS and server-side scripts

You can connect to server-side scripts that return XML data; for example, a Really Simple Syndication (RSS) feed might use a server-side script. Such RSS feeds have a URL ending in .aspx or .php. When an RSS feed has a URL ending in .xml or .ashx, use the XML file data connection method. You can connect to server-side scripts written in a variety of languages, including Microsoft ASP, Microsoft ASP.NET, PHP, and Asynchronous JavaScript and XML (Ajax).

XML files

SharePoint Designer interrogates the root of your current site and the Site Assets library for any XML files it might contain. You can also import an XML file into your site or refer to an XML file in another library or on another site by using the XML File Connection command.

Linked sources

Many data sources contain related data. You can use this data source group to combine two or more data sources into one source.

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.

Use the Data Source Properties dialog box to define the location and data that you want to be returned from the external system.

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.

Note

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.

Tip

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.

Note

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).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset