www.it-ebooks.info Ted Pattison Andrew Connell Scot Hillier David Mann Inside Microsoft ® SharePoint ® 2010 www.it-ebooks.info 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 corporate@oreilly.com. Visit our website at microsoftpress.oreilly.com. Send comments to mspinput@microsoft.com. 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 ctitious, 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 www.it-ebooks.info 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. www.it-ebooks.info www.it-ebooks.info Contents at a Glance SharePoint 2010 Developer Roadmap 1 SharePoint Foundation Development 35 SharePoint Developer Tools in Microsoft Visual Studio 2010 69 Sandboxed Solutions 89 Pages and Navigation 117 Controls and Web Parts 169 Lists and Events 225 Templates and Type Denitions 277 Accessing Data in Lists 319 Client-Side Programming 353 Creating and Developing Workows 393 SharePoint Security 455 Business Connectivity Services 485 Enterprise Content Management 535 SharePoint Search 569 www.it-ebooks.info www.it-ebooks.info Table of Contents Foreword xv Acknowledgments xvii Introduction xix 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 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 Denition 44 Creating a Solution Package 50 Feature Upgrade Enhancements in SharePoint 2010 61 Conclusion 68 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: microsoftcom/learning/booksurvey www.it-ebooks.info 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 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 Pages and Navigation 117 SharePoint Foundation Integration with ASPNET 117 ASPNET Fundamentals 118 SharePoint Web Applications 121 Web Application Conguration 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 www.it-ebooks.info Table of Contents 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 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 Templates and Type Denitions 277 Field Type Denitions 277 Creating Custom Field Types 278 Creating a Custom Field Control 284 List Denitions 292 Creating Site Column Denitions 294 Creating Content Type Denitions 296 Creating List Denitions 298 Feature Activation Dependencies 302 www.it-ebooks.info [...]... we recommend 8 GB of RAM on most machines ■ Microsoft SharePoint Foundation or SharePoint Server 2010 ■ Microsoft Visual Studio 2010 ■ Microsoft SharePoint Designer 2010 ■ Microsoft Office Visio 2010 www.it-ebooks.info xix xx Introduction Code Samples All the code samples discussed in this book have been added to a single zip archive named InsideSharePoint2010.zip This zip archive can be downloaded... to run on SharePoint Foundation Every installation of SharePoint Server 2010 begins with an installation of SharePoint Foundation After installing SharePoint Foundation, the installation for SharePoint Server 2010 then installs its own templates, components, and service applications Microsoft sells different editions of SharePoint Server 2010 using several different SKUs SharePoint Server 2010 Standard... components SharePoint 2010 is the fourth and most recent release of SharePoint technologies It includes Microsoft SharePoint Foundation and Microsoft SharePoint Server 2010 The goal of this chapter is to build your high-level understanding of SharePoint Foundation from the iewpoint v of a professional developer Along the way, you will learn how SharePoint Server 2010 extends SharePoint Foundation... SharePoint Portal Server 2003 2007 Windows SharePoint Services 3.0 Microsoft Office SharePoint Server 2007 2010 Microsoft SharePoint Foundation Microsoft SharePoint Server 2010 SharePoint 2001 introduced an environment that allowed users to create sites, lists, and document libraries on demand based on a data-driven design The implementation was based on a Microsoft SQL Server database that tracked... the high-level architecture of SharePoint Foundation For example, SharePoint Server 2010 delivers a good deal of its functionality through service applications Furthermore, many other groups within the Office team at Microsoft have built their own service applications that can be installed and c onfigured in a SharePoint 2010 farm SharePoint Server 2010 SharePoint Server 2010 is really just a piece... developers moving from SharePoint 2007 to SharePoint 2010 will be using these NET 3.5 features for the first time You should also note that the initial release of SharePoint 2010 won’t provide support for NET 4.0 At the time of this writing, Microsoft has not yet made any announcements about when NET 4.0 support will be integrated into either SharePoint Foundation or SharePoint Server 2010 SharePoint Farms... site that SharePoint Foundation automatically creates for each farm This administrative site is known as SharePoint 2010 Central Administration, and its home page is shown in Figure 1-4 Figure 1-4 SharePoint developers should become familiar with SharePoint 2010 Central Administration Notice that Figure 1-4 shows the home page of SharePoint 2010 Central Administration in a farm with only SharePoint. .. perating system, Microsoft Windows Server Microsoft makes money on SharePoint t echnologies by selling customers server-side licenses as well as client access licenses (CALs) Table 1-1 A Brief History of SharePoint Year Core Infrastructure Product Business Value Product 2001 SharePoint Team Services SharePoint Portal Server 2001 2003 Windows SharePoint Services 2.0 Microsoft SharePoint Portal Server... No matter where you are in your SharePoint development career, Inside Microsoft SharePoint 2010 provides you with a technical understanding that cuts across new features and functionality, giving you invaluable insight into SharePoint 2010 As you make your way through this book and beyond, I hope you’ll see and experience the great potential that lies within SharePoint 2010 For the developer, it represents... only SharePoint Foundation installed If SharePoint Server 2010 is also installed, you’ll see additional links to administrative pages that are not installed by SharePoint Foundation Also note that SharePoint 2010 Central Administration is extensible If you need to create a SharePoint solution for administrative purposes, you can integrate your work into SharePoint 2010 Central Administration by adding . on most machines ■ Microsoft SharePoint Foundation or SharePoint Server 2010 ■ Microsoft Visual Studio 2010 ■ Microsoft SharePoint Designer 2010 ■ Microsoft Ofce Visio 2010 www.it-ebooks.info . Visit our website at microsoftpress.oreilly.com. Send comments to mspinput @microsoft. com. Microsoft, Microsoft Press, ActiveX, Excel, FrontPage, Internet Explorer, PowerPoint, SharePoint, Webdings,. microsoft com/learning/booksurvey www.it-ebooks.info www.it-ebooks.info Foreword With the recent release of SharePoint 2010, one of Microsoft s fastest growing products has gotten even hotter. SharePoint 2010 has not only become more popular among end