P A R T   III

images

Integrating SharePoint

C H A P T E R  10

Consuming External Data

SharePoint is very good at enabling you to store data and present it on the Web, but most organizations have data in many different areas and systems that they would like to present in a web format. In previous chapters, you learned how to create data sources of internal data stores. In this chapter, you will learn how to connect to external sources of data and present that data on your SharePoint site. This chapter also covers SharePoint's new Business Connectivity Services, which makes it easier to surface your line-of-business data on your SharePoint site.

You will learn about the following topics in this chapter:

  • Working with the different data sources that connect to external data
  • Connecting to external data sources
  • Using Business Connectivity Services
  • Creating an external content type
  • Interacting with external data by using external lists
  • Incorporating external columns in standard SharePoint lists
  • Leveraging external content in Microsoft Office applications

images Note This chapter covers accessing stored data from an external source. To complete the exercises using Business Connectivity Services (BCS), you will need to download and install the AdventureWorksLT2008R2 sample database provided by Microsoft and found at http://sqlserversamples.codeplex.com/.

Why External Data?

As you read in Chapter 5, SharePoint is and has been a great platform to store and then present data in a web-based format. The challenge for most organizations is that they have a lot of data stored in other line-of-business (LOB) systems such as SAP, Microsoft Dynamics, and Oracle's Siebel and PeopleSoft products. Because SharePoint made it so simple to create web interfaces, users began to want to integrate and display their LOB data on the SharePoint platform.

While Chapter 5 dealt with surfacing data by using data sources of data in internal lists, this chapter covers how to consume and display data from external sources. SharePoint provides two basic ways of accessing external data: the data source interface and the Business Connectivity Services (BCS) interface. Both ways can help you build robust web applications in SharePoint—and with SharePoint Designer, you can accomplish this without writing code.

External Data Sources

In Chapter 5, you were introduced to the various data sources available to you via the Data Source menu on the Ribbon. Many times, data from external sources are delivered dynamically via the Web. SharePoint Designer provides for three types of external data sources that you can use in your site: an XML file connection, REST services, and SOAP services.

XML

Numerous web sites and services produce XML data to be used by other applications. SharePoint Designer provides an easy way to create a data source with the URL of the XML file. You can retrieve the XML anonymously or you can provide login credentials.

images Note It is important to remember that the XML file does not have to be static. It can change over time, which provides great advantages in being able to provide fresh content to your site. Also, the URL does not have to end in .xml. SharePoint is concerned only that the content of the URL contains valid XML.

EXERCISE 10-1. CREATE AND USE AN EXTERNAL XML DATA SOURCE

images

Figure 10-5. Final XMLExample.aspx

REST-Based Web Services

Web-services based on Representational State Transfer (REST) provide a simplified way of retrieving data from another external system. Most traditional web platforms that generate dynamic web pages, such as PHP or ASP, can return data with parameters supplied in a query string. If that same platform returns the data in XML format, it can be considered a RESTful service. SharePoint Designer provides an interface to connect to these REST services. In fact, the SharePoint web service interface can be considered a REST service. This makes it easy to display data from other SharePoint sites, even if they aren't in your farm. You just need the appropriate credentials.

REST services also can allow data to be written back to them. The SharePoint Designer REST Data Source Wizard gives you the option of using four commands: Select, Insert, Update, and Delete. It will also allow you to provide parameters expected by the service. You can specify login credentials if the service requires it.

EXERCISE 10-2. DISPLAYING DATA FROM A RESTFUL SERVICE

images

Figure 10-8. RESTExample.aspx

SOAP-Based Web Services

SOAP-based web services are a widely accepted standard web service, and they can provide a lot more functionality than REST services. REST services are limited to four commands, but SOAP-based services specify all of the operations that can be called by the client application in a service description file. The SOAP Connection Wizard provides the ability to create connections and to call all of the different operations provided by the service.

To find out what methods are available to a calling application, SOAP-based services provide a Web Services Description Language (WSDL) definition file that describes how to use the web service.

EXERCISE 10-3. CONNECT TO A SOAP-BASED SERVICE AND DISPLAY THE RESULTS ON A WEB PART PAGE

Business Connectivity Services (BCS)

Beginning with the Enterprise CAL of Portal Server 2003, Microsoft introduced a capability to surface external data in SharePoint. That was the first release of the Business Data Catalog (BDC), and not only was it was very code intensive, it allowed only read access to the data. In Microsoft Office SharePoint Server (MOSS) 2007, the BDC was greatly improved, but it was still code intensive and required an Enterprise CAL to use it. One big improvement was the ability to not only read LOB systems but to write back to those systems, albeit at a very primitive level that did not meet industry standards. In SharePoint 2010, Microsoft builds on the capabilities of the BDC with Business Connectivity Services (BCS). BCS allows simple, read/write access to external data with even the base, Microsoft Foundation, platform.

Common BCS Terminology

When discussing BCS, here are some common terms to be familiar with:

  • Business Connectivity Services (BCS) describes a broad range of technologies that are used to bring data from external systems (such as SAP, Oracle, Siebel, and PeopleSoft) to SharePoint 2010 and Office 2010.
  • Business Data Connectivity (BDC) is the new term used instead of the Business Data Catalog used in Microsoft Office SharePoint Server 2007. Business Data Connectivity refers to the connectivity runtime for both SharePoint Server and the Office clients.
  • External content type (ECT) is a very important concept to understand with the BCS. It is the building block of any BCS solution. The ECT is SharePoint's representation of the external data entity, such as sales, orders, or customers. It is a reusable collection of metadata that describes the connection information, data definitions, and behaviors of the data. All ECTs are stored in a dedicated database called the Business Data Connectivity Service database.
  • External List is a new list template in SharePoint 2010. This provides the same look and feel as regular SharePoint lists to external systems, including support for CRUD operations.
  • External data column is a column that is bound to an external system and can be added to an existing list or document library.
  • External data web parts are available only in the Enterprise version of SharePoint. The five web parts (Item, List, Related List, Actions, and Item Builder) can be added to any web part page to display external data.

Features by Version

SharePoint 2010 includes a majority of the BCS functionality in its base, Microsoft Foundation version. This is important because previous versions of SharePoint restricted this functionality to only the Enterprise version. Table 10-1 illustrates the differences in the versions of SharePoint 2010.

images

SharePoint Designer Support for BCS

SharePoint Designer 2010 provides robust support for working with BCS. You can accomplish almost all BCS operations in SharePoint Designer 2010 except create custom connectors or WCF services, which require Visual Studio 2010. Through the rest of this chapter, you will learn the different ways to work with BCS in SharePoint Designer, building on the knowledge of the previous sections. Exercises along the way will reinforce each topic.

images Note The following exercises utilize connections to the AdventureWorksLT2008R2 database, as explained at the beginning of this chapter. If you do not have access to the database, you will not be able to complete the exercises in the rest of this chapter.

Creating External Content Types

As previously mentioned, the main building block for BCS is the external content type. Any solution that you build to display external data requires that you define the external content type.

To create an external content type, you need to complete a few steps. Fortunately, there is a wizard to guide you.

EXERCISE 10-4. CONNECT TO AN EXTERNAL SYSTEM

images

Figure 10-19. External field mapping dialog box

Creating an External List

After you have clicked Finish to create your external content type, you can choose to create lists and forms from the external content type that you just defined. This can be accomplished by clicking Create Lists & Form from the Ribbon menu. A dialog box will open, prompting you to specify the List Name, Read Item Operation, System Instance, and Description for the list, as you can see in Figure 10-20. You can also elect to have InfoPath forms automatically created with the list.

images

Figure 10-20. Create List and Form dialog box

EXERCISE10-5. CREATE AN EXTERNAL CONTENT TYPE AND EXTERNAL LIST

Using External Columns

After you create an external column type, you can use the columns in regular SharePoint lists. A great example is using the AdventureWorks Customer content type in your Customer Correspondence document library.

  1. Open the browser to your site and click the Libraries link. Create a new document Library called Customer Contacts. Accept the defaults.
  2. Open your new library in the browser and on the Ribbon menu, select Library Settings.
  3. Click the Create Column option. In the Column Name field, enter AdventureWorksCustomer, as shown in Figure 10-29.
  4. Select the External Data radio button. Then in the external content type, use the selector to locate the Customer external content type you just created.
    images

    Figure 10-29. External data site column

  5. In the drop-down list that asks which field you want to show on this column, select CompanyName.
  6. In the field selector check boxes, select CustomerID, EmailAddress, FirstName, LastName, MiddleName, Phone, SalesPerson, Suffix, and Title, as shown in Figure 10-30.
    images

    Figure 10-30. Selecting additional fields to display

  7. Click OK to save. Your columns should look like Figure 10-31.
    images

    Figure 10-31. Customer contact site columns

  8. Go to the Views section of the Document Library Settings and click the All Documents view to edit it. Select the columns shown in Figure 10-32 to display.
    images

    Figure 10-32. All Documents view field selector

  9. Click OK to save the changes to the view.
  10. Now you will create your template. In the Document Library Settings, click Advanced Settings. Under Document Template, click the Edit Template hyperlink, as shown in Figure 10-33.
    images

    Figure 10-33. Document Template setting

  11. To add AdventureWorksCustomer fields to your Word template, choose Document Property from the Quick Parts Ribbon menu, as illustrated in Figure 10-34.
    images

    Figure 10-34. Inserting document properties with Quick Parts

  12. Edit the template as shown in Figure 10-35, inserting the appropriate fields from the Quick Parts menu. Press Ctrl+S to save your changes and then close Word.
    images

    Figure 10-35. Customer Contacts template

  13. Open your browser and navigate to the Customer Contacts document library. From the Documents Ribbon menu, select New Document.
  14. When the new document opens, use the Customer Picker to select Metropolitan Sports Supply by clicking the right side of the Customer Name field (see Figure 10-36). Notice how all of the fields are updated with the appropriate information.
    images

    Figure 10-36. New customer contact document

  15. In the Title property, type Customer Inquiry.
  16. Save to the document library. Notice that the fields are populated, as shown in Figure 10-37.
    images

    Figure 10-37. Customer Contact view after saving the document

If you have problems saving directly to the document library, you can go back to the document library and upload the document from your computer. All properties that you selected will still appear in the document library columns.

Summary

In this chapter, you learned about how you can use SharePoint Designer to connect external data to SharePoint and use that data in your SharePoint sites. You learned that SharePoint Designer supports connecting to external data sources and also learned about the powerful new Business Connectivity Services. It is important to remember the following about BCS:

  • External content types are the building blocks of the BCS.
  • You must first create an external content type before you can use any of the external data.
  • You can create external lists from the external content types, and you can interact with the external lists in the same way that you use internal SharePoint lists.
  • You can add individual external columns to regular SharePoint lists and libraries.
  • By mapping an external column to a document library, the external columns become part of the document roperties.

images

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

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