ebook img

Inside Microsoft SharePoint 2010 PDF

649 Pages·2011·7.018 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Inside Microsoft SharePoint 2010

Inside Microsoft ® SharePoint 2010 ® Ted Pattison Andrew Connell Scot Hillier David Mann Published with the authorization of Microsoft Corporation by: O’Reilly Media, Inc. 1005 Gravenstein Highway North Sebastopol, California 95472 Copyright © 2011 by Critical Path Training, LLC Complying with all applicable copyright laws is the responsibility of the user. All rights reserved. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without express written permission of O’Reilly Media, Inc. Printed and bound in the United States of America. 1 2 3 4 5 6 7 8 9 M 6 5 4 3 2 1 Microsoft Press titles may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Visit our website at microsoftpress.oreilly.com. Send comments to [email protected]. Microsoft, Microsoft Press, ActiveX, Excel, FrontPage, Internet Explorer, PowerPoint, SharePoint, Webdings, Windows, and Windows 7 are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Unless otherwise noted, the example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the author, O’Reilly Media, Inc., Microsoft Corporation, nor their respective resellers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by such information. Acquisitions and Development Editors: Martin DelRe and Kenyon Brown Production Editor: Holly Bauer Editorial Production: Custom Editorial Productions Technical Reviewer: David Mann Indexing: Fred Brown Cover: Karen Montgomery Compositors: Octal Publishing, Inc., and Nellie McKesson Illustrator: Robert Romano 978-0-735-62746-8 This book is dedicated to Patrick Tisseghem, our dear friend and colleague, who passed away at the beginning of this project. Those who were fortunate enough to know Patrick remember him and his outgoing sense of humor, his knowing smile, and his ability to completely explain complex topics using simple concepts and examples. Patrick, we all learned so much from knowing you and working with you. Many of your keen insights and clear explanations of SharePoint that you shared with us live on in this book. We miss you, all your blog readers miss you, and the entire SharePoint platform misses you as well. Contents at a Glance 1 SharePoint 2010 Developer Roadmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 SharePoint Foundation Development . . . . . . . . . . . . . . . . . . . . . . . . . . .35 3 SharePoint Developer Tools in Microsoft Visual Studio 2010 . . . . . . . .69 4 Sandboxed Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 5 Pages and Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 6 Controls and Web Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 7 Lists and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 8 Templates and Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277 9 Accessing Data in Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .319 10 Client-Side Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .353 11 Creating and Developing Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . .393 12 SharePoint Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .455 13 Business Connectivity Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485 14 Enterprise Content Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .535 15 SharePoint Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .569 v Table of Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xv Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xvii Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xix 1 SharePoint 2010 Developer Roadmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 SharePoint Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2 SharePoint Foundation Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3 SharePoint Farms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5 Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Service Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10 SharePoint Server 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13 Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 Customizing Sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 SharePoint Designer 2010 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Site Customization vs . SharePoint Development . . . . . . . . . . . . . . . . . . . . .22 Windows PowerShell Boot Camp for SharePoint Professionals . . . . . . . . . . . . . .23 Learn Windows PowerShell in 21 Minutes . . . . . . . . . . . . . . . . . . . . . . . . . . .24 The Windows PowerShell Integrated Scripting Environment (ISE) . . . . . .28 The SharePoint PowerShell Snap-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 2 SharePoint Foundation Development . . . . . . . . . . . . . . . . . . . . . . . . . . .35 The Server-Side Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 Creating the Hello World Console Application . . . . . . . . . . . . . . . . . . . . . . .36 Enabling the SharePoint Developer Dashboard . . . . . . . . . . . . . . . . . . . . . .39 Developing SharePoint Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 Developing a SharePoint Solution Using a Class Library Project . . . . . . . .41 The SharePoint Root Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42 Creating a Feature Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Creating a Solution Package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Feature Upgrade Enhancements in SharePoint 2010 . . . . . . . . . . . . . . . . . .61 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 3 SharePoint Developer Tools in Microsoft Visual Studio 2010 . . . . . . . .69 Life Before SharePoint Developer Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Getting Started with the SharePoint Developer Tools . . . . . . . . . . . . . . . . . . . . . .71 What do you think of this book? We want to hear from you! Microsoft is interested in hearing your feedback so we can continually improve our books and learning resources for you . To participate in a brief online survey, please visit: microsoft .com/learning/booksurvey vii viii Table of Contents Using SharePoint Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Adding a Feature Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 Adding a SharePoint Project Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 Deployment and Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Working with Mapped Folders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 4 Sandboxed Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 Understanding the Sandbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Building a Basic Sandboxed Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91 Understanding the Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .95 Understanding Solution Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 Designing a Sandboxed Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 Understanding Full-Trust Proxies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Administrating Sandboxed Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Using Central Administration Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Validating Sandboxed Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Using Windows PowerShell for Administration . . . . . . . . . . . . . . . . . . . . . 114 Using Site Collection Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 5 Pages and Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 SharePoint Foundation Integration with ASP .NET . . . . . . . . . . . . . . . . . . . . . . . . 117 ASP .NET Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 SharePoint Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Web Application Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 The Virtual File System of a Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Page Templates and Ghosting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Application Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Master Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Creating Site Page Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Creating Pages in Sandboxed Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 The Module SharePoint Project Item Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 The SandboxedSolutionPages Sample Project . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Creating Web Part Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Creating Output References to Integrate Silverlight Applications . . . . . . . . . . 149 Creating Pages in Farm Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Navigation Support for Application Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Custom Breadcrumb Navigation Using a Site Map . . . . . . . . . . . . . . . . . . . . . . . 157 Creating a Reusable Branding Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Deploying a Custom Master Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Deploying CSS Files and Images to the Style Library . . . . . . . . . . . . . . . . . . . . . 162 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Table of Contents ix 6 Controls and Web Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 Developing with Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 The WingtipControls Sample Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170 Safe Mode Processing and Safe Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 172 Using a Custom Control to Create a Menu . . . . . . . . . . . . . . . . . . . . . . . . . .175 User Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Delegate Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Developing Web Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Web Part Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Web Part Output Rendering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 Persistent Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Custom Editor Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Web Part Verbs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 Web Parts Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 Asynchronous Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 7 Lists and Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .225 Creating Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Fields and Field Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 Site Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 Content Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 Working with Document Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 Creating a Document Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Adding a Custom Document Template . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Creating Document-Based Content Types . . . . . . . . . . . . . . . . . . . . . . . . . 252 Programming with Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Creating Documents with Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 Creating and Registering Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Event Receiver Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 Registering Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Programming Before Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Programming After Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 8 Templates and Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277 Field Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Creating Custom Field Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Creating a Custom Field Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 List Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 Creating Site Column Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 Creating Content Type Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296 Creating List Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 Feature Activation Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.