www.it-ebooks.info PROFESSIONAL BUSINESS CONNECTIVITY SERVICES IN SHAREPOINT® 2010 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv CHAPTER 1 Business Connectivity Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 CHAPTER 2 Using BCS Solutions in SharePoint 2010 . . . . . . . . . . . . . . . . . . . . . . . . . .29 CHAPTER 3 Using BCS Solutions in Offi ce 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 CHAPTER 4 Creating BCS Solutions with the SharePoint Designer . . . . . . . . . . . . . 103 CHAPTER 5 Programming BCS Solutions in SharePoint 2010 . . . . . . . . . . . . . . . . . . .151 CHAPTER 6 Programming BCS Solutions in Offi ce 2010 . . . . . . . . . . . . . . . . . . . . . . 195 CHAPTER 7 Developing and Using Connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 CHAPTER 8 Working with BCS Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 CHAPTER 9 Working with Enterprise Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 www.it-ebooks.info www.it-ebooks.info Professional Business Connectivity Services in SharePoint® 2010 Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2011 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-61790-8 ISBN: 978-1-118-04381-3 (ebk) ISBN: 978-1-118-04380-6 (ebk) ISBN: 978-1-118-04379-0 (ebk) Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2010942336 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other countries, and may not be used without written permission. SharePoint is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. www.it-ebooks.info CONTENTS INTRODUCTION xxv CHAPTER 1: BUSINESS CONNECTIVITY SERVICES 1 Challenges Integrating External Data 2 User Challenges 3 IT Challenges 3 Introducing Business Connectivity Services 3 Evolution of the Business Data Catalog 4 BCS and Other Integration Services 5 Architecture Overview 7 Key Capabilities 9 Presentation 9 Connectivity 11 Tooling 12 BCS in SharePoint and Offi ce SKUs 13 Creating Simple BCS Solutions 14 Creating External Content Types 14 Creating External Lists 16 Connecting External Lists to Offi ce 2010 17 Types of Solutions 19 Simple Solution Leveraging Out-of-the-Box Capabilities 20 Intermediate Declarative Solution 20 Advanced Code-Based Solution 21 Solution Packaging 22 ClickOnce Package 23 Deployment Concepts 24 Security 24 Authentication Overview 25 Claims and OAuth 25 Offi ce Client 26 Authorization Overview 26 Summary 27 www.it-ebooks.info CONTENTS CHAPTER 2: USING BCS SOLUTIONS IN SHAREPOINT 2010 29 Understanding Business Data Connectivity 29 Introducing the BDC Metadata Model 30 BDC Metadata Store 32 Resource Files 32 Versioning 33 BDC Service Application 34 Managing the BDC Service Application 35 Permissions 36 Model Import 38 Model Export 39 Managing External Content Types 40 Managing Actions 41 Managing Profi le Pages 44 Throttling 46 BDC Server OM 48 Integrating BCS Data with SharePoint 49 Using External Lists 49 Permissions 50 View Settings 50 DateTime Fields 51 Forms 52 Diff erences from Regular Lists 53 Life Cycle and Portability 55 Using External Data Web Parts 56 Using the Chart Web Part 60 Creating External Data Columns 60 Mobile Device Support 63 Time Zone Support 63 User Profi le Enhancements Using ECTs 64 Searching External Systems 65 Using Workfl ow to Access External Data 66 Simple Workfl ows 66 Intermediate Workfl ows 67 Advanced Workfl ows 68 Upgrading from MOSS 2007 69 Summary 71 xviii www.it-ebooks.info CONTENTS CHAPTER 3: USING BCS SOLUTIONS IN OFFICE 2010 73 Understanding Business Data Connectivity 73 Understanding the BDC Client Runtime 74 Understanding the Metadata Cache 75 Understanding Subscriptions in the Metadata Cache 76 Understanding Cache Population 78 Understanding Cache Operations 79 Understanding Solution Deployment 82 Understanding ClickOnce Deployment 83 Understanding ClickOnce Security 84 Connecting External Lists to Outlook 87 Understanding BCS Folder Limitations 87 Understanding Form Limitations 87 Understanding Functional Limitations 89 Understanding SharePoint Security Limitations 89 Synchronizing Outlook Data 89 Managing Client Credentials 90 Updating Outlook Solutions 91 Connecting Lists to the SharePoint Workspace 92 Understanding SPW Architecture 92 Understanding the Offi ce Document Cache 93 Synchronizing External Lists 94 Writing Scripts and Macros 94 Using External Data in Word 96 Using External Data Columns 97 Creating Reusable Site Content Types 97 Understanding External Data Limitations in Word 100 Working with External Data in Microsoft Access 101 Summary 102 CHAPTER 4: CREATING BCS SOLUTIONS WITH THE SHAREPOINT DESIGNER 103 Working with the BDC Metadata Model 103 Working with External Data Sources 106 Connecting with the SQL Server Connector 107 Connecting to Microsoft SQL Server Databases 107 Connecting to Oracle Databases 108 Connecting to ODBC Data Sources 110 Connecting to OLE DB Data Sources 111 xix www.it-ebooks.info CONTENTS Connecting with the WCF Service Connector 111 Connecting to ASP.NET Web Services 112 Connecting to WCF Web Services 114 Creating Methods 115 Implementing Method Stereotypes 117 Defi ning Properties 118 Defi ning Parameters 118 Defi ning Filters 118 Understanding Stereotype Requirements 118 Creating Methods for Databases 122 Creating Finder Methods 122 Modeling Finder Methods 124 Understanding the Default Finder 129 Creating Other Methods 129 Creating Methods for Web Services 130 Defi ning Associations 131 Creating One-to-Many Associations 131 Creating Self-Referential Associations 134 Creating Reverse Associations 136 Working with Many-to-Many Relationships 136 Working with External Lists 137 Creating Custom List Actions 137 Creating Custom Forms 138 Creating ASPX Forms 138 Creating InfoPath Forms 139 Accessing External Lists in Code 140 Using the SPList Object 140 Using the Client Object Model 141 Initiating Workfl ows 143 Developing Solutions 146 Making Solutions Portable 146 Converting ASP.NET Solutions 147 Upgrading BDC 2007 Solutions 149 Summary 150 CHAPTER 5: PROGRAMMING BCS SOLUTIONS IN SHAREPOINT 2010 151 Working with the BDC Server Runtime Object Model 151 Connecting to the Metadata Catalog 153 Retrieving Model Elements 154 Executing Operations 155 xx www.it-ebooks.info CONTENTS Executing Finder Methods 158 Executing Specifi cFinder Methods 161 Executing Updater Methods 162 Executing Creator Methods 163 Executing Deleter Methods 164 Executing AssociationNavigator Methods 165 Working with Complex and Unsupported Types 167 Using InfoPathForms for Display 169 Using Complex Formatting for Display 171 Using Custom Field Types for Display 174 Advanced Workfl ow Solutions 178 Developing Visual Studio Workfl ows 179 Developing Pluggable Services 179 Working with Sandbox Workfl ow Actions 182 Working with the BDC Administration Object Model 185 Connecting to the Catalog 185 Creating BDC Metadata Models in Code 186 Importing and Exporting Models 188 BCS Limits 189 Summary 193 CHAPTER 6: PROGRAMMING BCS SOLUTIONS IN OFFICE 2010 195 Creating Outlook Declarative Solutions 195 Generating Artifacts 196 Packaging and Deploying Solutions 200 Creating Custom Form Regions 201 Creating Custom View Defi nitions 203 Including Associations in Declarative Solutions 204 Creating Custom Actions, Ribbons, and Parts 206 Coding the Custom Elements 207 Packaging the Custom Elements 210 Working with the BDC Client Runtime Object Model 213 Connecting to the Metadata Catalog 215 Understanding the Execution Context 216 Executing Cache Operations 218 Exploring the Client Cache 220 Creating Offi ce Add-Ins 224 Adding Ribbon Support 224 Creating a Custom Task Pane 227 Packaging Data-Only Solutions 229 Summary 231 xxi www.it-ebooks.info CONTENTS CHAPTER 7: DEVELOPING AND USING CONNECTORS 233 Developing Connectors 233 Creating .NET Assembly Connectors 234 Understanding the Project Tooling 235 Walking through the Development Process 238 Creating a New Project 238 Creating a New Entity 239 Creating a Finder Method 240 Creating a Specifi cFinder Method 242 Handling Connection Information 243 Implementing the Methods 245 Adding Creator, Updater, and Deleter Methods 246 Adding a StreamAccessor Method 249 Creating Associations between Entities 251 Understanding Non–Foreign Key Relationships 253 Testing the Connector 254 Creating Custom Connectors 254 Understanding Project Elements 255 Walking through the Development Process 255 Starting the Project 256 Handling Connection Information 256 Defi ning the Entity 257 Defi ning the Finder Method 257 Implementing the Finder Method 258 Defi ning the Specifi cFinder Method 260 Implementing the Specifi cFinder Method 261 Defi ning the Creator Method 263 Implementing the Creator Method 263 Defi ning the Updater Method 265 Implementing the Updater Method 266 Defi ning the Deleter Method 267 Implementing the Deleter Method 267 Creating Confi gurable Connection Properties 268 Specifying a Connection Manager 268 Using the Custom Connector 269 Handling Errors in Connectors 272 Handling Runtime and Validation Errors 272 Handling Concurrency Issues 272 Packaging Considerations 277 Summary 279 xxii www.it-ebooks.info