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:
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/
.
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.
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.
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.
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
Figure 10-5. Final XMLExample.aspx
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
Figure 10-8. RESTExample.aspx
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
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.
When discussing BCS, here are some common terms to be familiar with:
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.
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.
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.
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
Figure 10-19. External field mapping dialog box
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.
Figure 10-20. Create List and Form dialog box
EXERCISE10-5. CREATE AN EXTERNAL CONTENT TYPE AND EXTERNAL LIST
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.
Figure 10-29. External data site column
Figure 10-31. Customer contact site columns
Figure 10-32. All Documents view field selector
Figure 10-33. Document Template setting
Figure 10-34. Inserting document properties with Quick Parts
Figure 10-35. Customer Contacts template
Figure 10-36. New customer contact document
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.
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:
3.14.252.56