Chapter 15. Business Connectivity Services

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • How to configure a BCS Application

  • How to use BCS with SharePoint 2010

  • How to work with BCS as a SharePoint administrator

  • How to develop custom solutions for BCS

Business Connectivity Services (BCS) is all about using SharePoint to connect the isolated silos of data in your company. What kind of data exists in any given organization? There are payroll and personnel systems, patient databases in healthcare, customer and vendor databases, and sales and inventory systems. The list goes on and on. These different types of databases can be seen as separate islands of information, but with SharePoint 2010 and the BCS, they can all be brought into one interface. External content types (ECTs) are new in SharePoint 2010, and they allow for the exposure of data from external systems, such as databases and Web Services, into SharePoint. There is a new type of list called an external list, which has the appearance of a regular SharePoint list, but is really a web interface directly to the external data. Compared to the read-only nature of the SharePoint 2007 Business Data Catalog, the new BCS not only allows viewing of the external data, but also provides the ability to insert, update, and delete data. All of this can be done out-of-box, in an easy user interface, without having to write any custom code! Figure 15-1 shows a high-level diagram of BCS, featuring some ways that SharePoint interfaces with external data sources.

The ability to have one point of interaction with various business systems within SharePoint and Office applications has the potential to drastically increase work efficiency. Instead of having disparate systems and various logins, business users will be able to go to a single place to access these systems, and that is SharePoint.

FIGURE 15-1

Figure 15-1. FIGURE 15-1

CONFIGURING A BCS APPLICATION

When creating and configuring a BCS application, there are several factors to take into consideration before beginning. The main factor, and the most complicated one, is security. Once the decision has been made regarding which method or combination of authentication methods will be used, the easy part is the creation of the external content type. Creating an application sounds like something that only developers would do, but in the case of the BCS, that is not necessarily true. In this section, we will go over a high-level list of some security and authentication options, and then show examples of how to go about creating an external content type and external list from scratch.

Security Considerations

When working with Business Connectivity Services, the security options are quite varied and complex. The concepts of database security and authentication are out of the scope of this book, but here is a high-level list of several levels to consider when setting up user access to the BCS data:

  • Database security: Grant end users permission directly on the databases that they will be using in the ECTs.

  • External content type permissions: In the Service Application in Central Administration, permissions can be granted per ECT, as shown in Figure 15-2.

  • Operations: When the ECT is created, a database table is selected, and the operations are created. These are referred to as CRUD (create, read, update, delete). There is the ability to create all of these operations in an ECT, but it is not required. Pick and choose specific operations that you want to allow, if necessary.

    FIGURE 15-2

    Figure 15-2. FIGURE 15-2

  • SharePoint list permissions: This does not apply to the ECT, only to the external list. Use permissions on one of these lists in the same manner as with any other SharePoint list or library.

  • Impersonation: When creating an ECT, and the database connection is being added, there is a prompt called SQL Server Connection, as shown in Figure 15-3. Instead of giving the end users direct access to the database, an impersonation can be created and used, via an Application ID from the Secure Store Service Application.

    FIGURE 15-3

    Figure 15-3. FIGURE 15-3

  • BCS Identity: There is one more, lesser-known method of authentication. Using the BCS Identity allows the connection to Revert To Self, which means that it uses the BCS service identity to connect to the data. With this method, secure store target applications need not be created.

Of these multiple levels, the strictest level of security will always apply. For example, if users do not have access to the external content type, and they are given "Full Control" SharePoint permissions, they will still not have any access to that list. For more information about BCS security and authentication options, refer this TechNet site: http://technet.microsoft.com/en-us/library/ee661743.aspx.

Warning

When logged-in users have direct access to the database that is used in the ECT, their credentials need to be passed all the way from their Windows login to SharePoint, and then from SharePoint to the back-end system where the BCS data lives. This is referred to as a double-hop, since the identity has to be passed twice. If the organization is going to grant users access to the back-end data and use this method, then NTLM authentication in SharePoint will not be sufficient, and Kerberos will have to be implemented.

Creating External Content Types

External content types (ECTs) are the cornerstone of Business Connectivity Services. Think of each ECT as equivalent to a table in a database. Several ECTs can be created to represent multiple tables in the database, and tables can even be associated with each other, which represents the same concept as table relationships or joins. After you've read this chapter and have seen examples of how ECTs are used within SharePoint, the business reasons for utilizing the new BCS will become apparent.

Note

SharePoint Designer 2010 is a free desktop application and can be obtained from Microsoft's download site here: http://bit.ly/SPD2010-32. Chapter 5 showed how to use SharePoint Designer to create custom workflows with no code.

Creating External Lists

Once the ECT has been created, the next step is to create an External List, which is a SharePoint list that directly interfaces to the back-end database data. This list data is not stored in SharePoint but remains in the external system, with SharePoint as the front-end web interface to the live data. Although external lists have the familiar look and feel of any regular SharePoint list, there are a few things that are not included, such as versioning, check in/out, workflows, and content types. Not only are these lists wonderful because they have that familiar user interface, but also, as you will learn later in this chapter, this business data can even be taken offline.

When an external list is created, its columns come from the external content type, and cannot be modified from within the list settings. Views can be created, in order to display the desired columns, but the columns themselves cannot be changed, added, or removed. There is a one-to-one relationship between an external content type and its external list.

Understanding Profile Pages

A profile page is a page in SharePoint that displays detailed information about a single item in a database table. It is simply an item detail page. This web part page can be customized by changing the theme and even adding other web parts such as a company logo. The profile page is not related to the external list that has been created. These pages are typically used with the Business Data web parts, which will be covered later in this chapter.

Before the first profile page can be created, several criteria must exist, as follows:

  • A SharePoint site must be created by an administrator as the dedicated location for all profile pages.

  • The administrator must grant at least Design permissions to anyone who will be creating or updating profile pages.

  • Business users who will be viewing the business data must be granted read permission on this site.

  • In Central Administration, in the Business Connectivity Service application, the administrator sets the URL of the dedicated site that has been created. To do this, in the Ribbon, click the Configure button in the Profile Pages section, check the box to Enable Profile Page Creation, paste the URL, and click OK.

Once the above criteria have been met, profile pages may be created for any ECT. Open any ECT in SharePoint Designer, and click the Create Profile Page in the Ribbon, as shown in Figure 15-14. Note that an external list for the ECT is not required in order to use a profile page.

FIGURE 15-14

Figure 15-14. FIGURE 15-14

Profile pages are also important if the BCS data will be searchable. Searching BCS data will be covered later in this chapter; just keep in mind that when BCS results are discovered, the search results page will include the link to the profile page of the found item. Figure 15-15 shows an example of a profile page for the "Stores" external content type.

FIGURE 15-15

Figure 15-15. FIGURE 15-15

Understanding Associations

In the BCS, associations can be created in order to join two tables by a common field. This concept can be likened to creating relationships in Microsoft Access and other database programs. Use associations when a field in one external table needs to look up (join) to a field in another table.

The interface to create associations can be found on the Operations Design View of any ECT. For an association to be created, more than one ECT needs to exist. First of all, define the names of the fields to be associated with each other. For example, the Sales table has a field called Store Key, which can be associated with the Store Key field in the database's table called Stores. There can be many items in the Sales table related to any one item in the Stores table. With this relationship, each sale that takes place in the company can be linked with a specific store. When associations have been created, this allows for very rich and interactive BCS web part interfaces to be created. Figure 15-16 shows an example of two related (associated) tables.

FIGURE 15-16

Figure 15-16. FIGURE 15-16

After the association has been created, generate a profile page for the Stores ECT. This new profile page not only will contain details about one store record but also will automatically include a connected web part with the list of sales transactions that have occurred for that store.

Understanding Business Data Actions

Business Data Actions can be created for each ECT and are best described as different links that can be clicked from within the ECT. These are actions that can be carried out in relation to the currently displayed ECT detail item. For example, create business data actions in order to link directly to the edit page for an item, or to navigate to a page that contains web parts that are filtered by certain query string parameters.

Business Data Actions are only created by an administrator from within the ECT in Central Administration. In the Business Data Connectivity Service application, click the name of any ECT to see its detailed information page. This configuration screen contains the list of existing actions, and the Ribbon has buttons that allow for the creation, modification, and deletion of any of them. Figure 15-17 displays the default View Profile action that exists in an ECT.

FIGURE 15-17

Figure 15-17. FIGURE 15-17

The following is a list of the fields to fill out when creating a new action:

  • Action Name: This is the text that is displayed on the Action button.

  • URL: The URL will always include a query string parameter, just like the "Example" text that is displayed in the URL box.

  • URL Parameters: Since the URL will need to include a query string, the URL parameters must be defined in order to match each parameter with a field in the data source. In this example, the SalesKey is the parameter, so when "SalesKey=a value" is included in the URL, the number is equivalent to a specific sales item. Where the brackets {0} are inserted into the URL will be the location of the SalesKey.

  • Icon: This is the icon that will represent this action, and it will be displayed on the button next to the action name. Use a URL to an image. The example includes a URL pointing to a location on the SharePoint server.

  • Default action: Check this box to indicate if this should be the default in the list of Actions.

WORKING WITH BCS

Once external content types and external lists have been created, there are several different ways that they can be utilized within SharePoint. BCS data can be taken offline using Outlook or SharePoint Workspace, and interactive interfaces to the data can be created using the BCS web parts. There are many possibilities for the creation of custom business solutions, all without needing to write any code.

Accessing BCS Data from Outlook 2010

There are certain types of SharePoint lists that can be connected to Outlook and taken offline. These lists are Contacts, Tasks, Calendars, and Discussion Boards. The ECT that was created at the beginning of this chapter was created as the default Generic List, which is the equivalent of a custom list in SharePoint, and cannot be connected to Outlook. Now, with Business Connectivity Services, each ECT can be created as one of the following list types:

  • Generic List: Custom list, cannot be connected to Outlook

  • Appointment: Can be connected as an Outlook Calendar

  • Contact: Can be connected as Outlook Contacts

  • Task: Can be connected as Outlook Tasks

  • Post: Can be connected as a Discussion Board in Outlook 2010

The ability for business users to work on database data offline is quite powerful. Think about systems such as those used in customer relationship management (CRM) and the ability to use those contact lists or filtered subsets of them in daily activities within Outlook.

Using BCS Associations

Earlier in this chapter, a high-level explanation of associations was given. In this section, you will learn how to create them, and why. This section contains more information about the context in which associations are created, and the effects of existing associations on web parts.

Accessing BCS Data from SharePoint Workspace 2010

SharePoint Workspace 2010 is part of the Office Suite of applications and is used to take SharePoint data offline. Business users who travel frequently or remote workers who have less reliable network connections will find this tool invaluable. Not only can SharePoint lists and libraries be taken offline and changes synchronized when you're back on the network, but now the BCS allows you to take external lists offline to work on them from wherever you are.

SharePoint custom lists, and external lists that are created as Generic Lists, cannot be taken offline in Outlook, but they can be taken offline and synchronized using SharePoint Workspace. Figure 15-22 shows an external list as viewed from within SharePoint Workspace.

FIGURE 15-22

Figure 15-22. FIGURE 15-22

Using the BCS Web Parts

There are several out-of-the-box web parts that can be used in order to display data from ECTs. Inherently, these web parts are not related to the external lists at all, and are only associated with ECTs. In other words, externals lists do not need to exist in order to make use of these web parts.

Business Data List

Use this web part to display a list of data from a single ECT. The information is shown as a table on the page. The web part settings allow for the selection of an existing ECT in the Type box.

There is a drop-down box called View, where an existing view may be selected. Since these web parts are not related to external lists, any views that have been created at the list level will not be shown here. This list of "views" is really the list of Read List Operations that have been defined in the ECT.

Business Data Item

This web part displays a single item from an ECT. The Web Part tool pane has settings to select the external content type and then optionally pick a specific list item. There is also a button to pick the fields that need to be displayed, as well as a button to select actions. The Item field does not have to be filled in, because the item to be displayed can be passed to this web part using a web part connection. Web part connections were covered in detail in Chapter 7.

Business Data Actions

This web part displays a list of the actions associated with a specific external content type. It is simply a view of the links to the different actions for the ECT that is specified in the web part properties.

Business Data Connectivity Filter

This web part performs a filter using data that exists in an ECT. In the Web Part tool pane, pick an ECT. Optionally, pick a default record in the table. This web part is then meant to be connected to another web part on the page, to pass filters or parameters to it. The Business Data Connectivity Filter has no use if not connected to other web parts, using web part connections. This web part can be used to pass business data to web parts such as those that display SharePoint list or library data; it does not need to be used in conjunction with other Business Data web parts.

Business Data Item Builder

The Business Data Item Builder is used on a page in order to pass query string information from the URL to the web parts on the page. This web part automatically exists on all BCS profile pages. This web part is not seen unless the page is in edit mode, as it is only used to pass parameters and has no user interface. For example, once the profile page for the Stores ECT has been created, and an item name is clicked in a BCS web part, the URL for the profile page will have a query string. In this case, it is "StoreKey = 4". The StoreKey is the unique identifier in the table. The Business Data Item Builder sees this unique StoreKey and can pass it to other web parts on the page through web part connections.

Business Data Related List

When associations have been created between external content types, they are considered "related lists." When the Business Data Related List web part is inserted on a page, it allows you to pick a list that is related to a BCS ECT that has been added to the same web part page. For example, if a page already contains a Business Data list of stores, and a Business Data Related List is inserted on the page, the only option for the source data will be the Sales ECT, since it is the only one that is related to Stores. A web part connection still needs to be created between the sales and stores web parts, to pass the filter information.

Chart Web Part

Chart web parts are new in SharePoint 2010 and were covered extensively in Chapter 7. One of the data source options that can be used is Connect to Business Data Catalog, which allows an ECT to be selected. Once the source has been selected, configure the X and Y axis and customize the way the chart appears visually. This web part was covered in detail with screenshots in Chapter 7.

Using the External Data Column

The external data column is a type of column that can be added to any list or library. Once external content types have been set up, create lookups to their data by adding external data columns.

Earlier in this chapter, in the Try It Out titled "Creating an External Content Type," step 13 mentioned the checkbox for "Show in Picker." You can select this checkbox for each column of data. When you use an external column, this column is filled in for the list items, and data is looked up in the ECT. The interface for the selection of data is similar to that of the people picker control. In Figure 15-30, the field is being filled out with "Seattle"as the search term to find the correct store in the list. This interface is what is referred to as the picker, and was used in step 8 above if you clicked the item picker button.

Note

An external list is not required in order to use an external content type in an external data column.

FIGURE 15-30

Figure 15-30. FIGURE 15-30

Using BCS Data in Office Applications

External data columns that have been created in libraries can be utilized within Office applications such as Word and Excel. The Document Information Panel and Quick Parts were first introduced in SharePoint 2007, and they still have very powerful capabilities when it comes to Office integration with SharePoint. In this section, you will learn about these points of integration, the differences, and how they can be utilized in business examples.

The Document Information Panel is a small panel that displays a document library's metadata inside of the associated Office application. All columns associated with a library are editable in this panel. Just as with any other columns, business data is also surfaced inside of the Document Information Panel.

Note

Note that in Office 2007, the document information panel will display the BCS data, but those fields are not editable from within that interface. Office 2010 will allow for both viewing and editing of these fields from within the application.

FOR THE ADMINISTRATOR

For those who have administrator access in Central Administration, there are some additional interfaces to the BCS to note. Within the Search Service Application, there is a way to index BCS data. Also, in the User Profile Service Application, BCS data can be added as a secondary user profile data source. This section touches on topics that are pertinent to SharePoint Administrators. For information that is targeted to administrators, there is a book called Professional SharePoint 2010 Administration by Todd Klindt, Shane Young, and Steve Caravajal (Wrox, 2010) that goes into much more detail.

Searching BCS Data

When performing searches within SharePoint, there are several types of data that can be searched for. In addition to SharePoint sites, websites, file shares, and Exchange public folders, ECTs can be searched. This is simply another type of content source that the administrator can create in the search administration area. Once an ECT database has been added as a content source and crawled, relevant results will be included on the search results page. Just as with SharePoint results, the BCS data will be security trimmed, so that users will only see data results that they have access to.

In the search service application in Central Administration, look at the list of content sources. When a new content source is created, you can choose Line of Business Data as the content source type. This will allow for the selection of either all business data, or particular databases. Once the BCS source has been added and crawled, its items will be returned as part of regular search results. Figure 15-36 shows the creation of a new BCS content source.

FIGURE 15-36

Figure 15-36. FIGURE 15-36

Secondary User Profile Data

In situations where user profile information is stored in multiple systems and databases, it can all be brought together in SharePoint using the BCS. For example, an organization may store basic directory information about users in Active Directory. Then, their personnel information such as salary and performance information may be stored in a database that is external to SharePoint and Active Directory. As long as there is a field that exists that is unique to each user and is common between Active Directory and the other system, a new BCS connection can be created in order to bring in each user's associated information from that external source.

From within the User Profile Service Application's Configure Synchronization Connections page, once the main LDAP connection (such as Active Directory) has been created, BCS can be created as a secondary connection. When a new synchronization connection is created, pick the desired external content type. As shown in Figure 15-37, the next choice is whether the relationship is one-to-one, or one-to-many between Active Directory and the ECT. It is important that the field called Return items identified by this profile property contain a field that will match items in the two systems together.

FIGURE 15-37

Figure 15-37. FIGURE 15-37

DEVELOPING CUSTOM SOLUTIONS FOR BCS

Custom Business Connectivity Services solutions can be developed using Visual Studio 2010. Custom development is not just for programmers, though. Custom BCS Solutions can be created as XSLT List View web parts in SharePoint Designer. These were previously referred to as Data View web parts. These custom web parts allow you to granularly format the way the information looks on the page, adding conditional formatting, grouping, sorting, and filtering.

Open your SharePoint site and external list in SharePoint Designer 2010. In the views section at the top right, click the New button to create a new XSLT list view. When the cursor is placed inside the table content in the middle of the page, a new section will appear in the contextual Ribbon at the top, called List View Tools. This section of the Ribbon contains four tabs that contain all of the buttons that are needed for configuring the view: Options, Design, Web Part, and Table.

SUMMARY

Business Connectivity Services in SharePoint 2010 are the key to utilizing data from various data silos in your company. Take the personnel system, sales database, and patient accounting system, and bring them all into a single familiar interface, which is SharePoint. ECTs with external lists are web interfaces into the live back-end data. Once the proper security and authentication methods have been implemented, BCS gives you wonderful tools to make the organization much more streamlined and efficient. Use the Business Data web parts, external data columns, and even workflows in order to incorporate these typically separated islands of data into all of the familiar SharePoint web part pages and interfaces that the business users are accustomed to.

The following table contains a list of Internet references. These sites can be used in order to obtain more detailed information about BCS topics.

SITE NAME

URL

BCS Resource Center

http://technet.microsoft.com/en-us/sharepoint/ee518675.aspx

BCS Team Blog

http://blogs.msdn.com/b/bcs/

BCS Information on MSDN

http://msdn.microsoft.com/en-us/library/ee556826(office.14).aspx

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

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