Reference Implementation: External Lists

External lists enable you to view and manipulate external data in the same way that you can view and manipulate data stored in regular SharePoint lists. In this reference implementation, we deploy a sandboxed solution that includes external lists. The solution demonstrates how sandboxed Web Parts can query and present the data provided by the external lists.

External lists rely on external content types to interact with external data sources. You can view an external content type as a bridge between the external list and the external data source. Unlike external lists, external content types cannot be defined or used directly within sandboxed solutions. Instead, they are typically created dynamically in SharePoint Designer or in Visual Studio 2010 if they are more complex. They are then managed by the Business Data Connectivity (BDC) service application, which runs with full trust. This use of an external list in a sandboxed solution is an example of a hybrid approach to execution. It allows you to manipulate external data from within the sandbox environment, which would not otherwise be permitted.

Note

Note: We recommend that you review Execution Models in SharePoint 2010 before studying this reference implementation. The Execution Models chapter provides a more detailed explanation of many of the concepts described here.

This implementation demonstrates the details and best practices for the following areas:

  • Creating and consuming external lists from a sandboxed solution
  • Creating and managing external content types in the BDC service application
  • Configuring the Secure Store Service (SSS) to enable sandboxed code to impersonate credentials for external data sources

Note

Note: This reference implementation makes use of many design and implementation techniques that were the focus of the preceding reference implementations. These techniques include exception shielding, the use of various design patterns, and the use of the client object model to launch modal dialog pages. For a detailed discussion of these approaches, see the sandbox reference implementation and the full trust proxy reference implementation.

Solution Scenario

In this example, suppose you are a SharePoint consultant working for a pharmaceutical company named Contoso, Inc. The procurement manager at Contoso, Jim Hance, wants to be able to view a summary of financial transactions with vendor organizations.

At present, vendor transactions are recorded in Contoso's vendor management system, a proprietary database application based on SQL Server. To meet Jim's requirements, you first create a set of external content types that map to different tables in the vendor management database. Next, you create a set of external lists to surface the data from the external content types. Finally, you create a Web Part that shows a list of vendors. Jane can click a vendor name to start a modal dialog that displays a list of transactions for that vendor, as illustrated in the following illustrations.

Vendor list of transactions

Ff798440.ed35e35f-b101-4114-bcc8-20309e53b753(en-us,PandP.10).png

Vendor transaction details

Ff798440.1f52d31d-355b-41cf-b576-a73f2846ca8e(en-us,PandP.10).png

Deploying the External Lists RI

The External Lists RI includes an automated installation script that creates various site collections, deploys the RI components, and adds sample data. After running the installation script, browse to the Headquarters site collection at http://<Hostname>/sites/ Headquarters. You can open and run the project in Visual Studio, but this does not create a site collection or add sample data. To see the fully functioning system, you must run the installation script.

The following table answers questions you might have about how to get started with the External Lists RI.

Question

Answer

Where can I find the External Lists RI?

<install location>\Source\ExecutionModel\ExternalList

Which file is the solution file?

ExecutionModels.Sandbox.ExternalList.sln

What are the system requirements?

SharePoint Server 2010 Standard or Enterprise Edition (for Secure Store Service)

What preconditions are required for installation?

  • You must be a member of the SharePoint Farm administrator group.
  • You must be a member of the Windows administrator group.
  • SharePoint must be installed at http://<Hostname:80>. If you want to install SharePoint in a different location, you can edit the location settings in the Settings.xml file located in the Setup directory for the solution.
  • SharePoint 2010 Administration service must be running. By default, this service is set to a manual start. To start the service, click Start on the taskbar, point to Administrative Tools, click Services, double-click SharePoint 2010 Administration service, and then click Start.
  • The timer service must be running. To start the timer service, click Start on the taskbar, point to Administrative Tools, click Services, double-click SharePoint 2010 timer, and then click Start.

How do I Install the External List RI?

Follow the instructions in the Readme.txt file located in the project folder.

What is the default installation location for the External List RI?

http://<Hostname>/sites/Headquarters

You can change this location by changing the Settings.xml in the Setup directory.

How do I download the External List RI?

The External List RI is included in the download Developing Applications for SharePoint 2010.