RTM’d today: Inside Microsoft SharePoint 2010

clip_image002

We’re very pleased to announce that Ted Pattison, Andrew Connell, Scot Hillier, and David Mann’s book, Inside Microsoft SharePoint 2010 (ISBN 9780735627468) has shipped to the printer!

Guided by an author team with in-depth knowledge of SharePoint architecture, you’ll gain task-oriented guidance and extensive code samples to help you build robust business solutions that leverage the features of SharePoint Foundation and SharePoint Server 2010. Learn to build complete SharePoint 2010 solutions using deep architectural insights from the experts.

Get a detailed look at SharePoint 2010—and master the intricacies of developing intranets, extranets, and Web-based applications. Master the fundamentals of developing in terms of features and solutions. Learn the architectural differences between farm solutions and sandboxed solutions. Create page templates, master pages, Web Parts, custom controls and event handlers. Develop custom field types, site columns, content types, and list definitions. Learn to query SharePoint sites using the new LINQ-to-SharePoint provider. Leverage the new Client Object Model in JavaScript and in Silverlight applications. Leverage and extend the new Enterprise Content Management (ECM) features. Configure and extend Business Connectivity Services (BCS) and Enterprise Search. The book also provides code samples and bonus content on the Web

The book will be available via online retailers around February 15. In the meantime, here’s more information about the book:

Table of Contents

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 . 3 ……….5

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 ClassLibrary 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

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

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

Site Definitions ………..304

Configurations and Web Templates . 3 ………..05

ONET.XML: The Site Definition Manifest . ………..306

The Global Site Definition ……….. 310

Creating and Initializing Sites ………..312

Creating a Site Provisioning Provider . ………..314

Conclusion . ………..318

9 Accessing Data in Lists ………..319

Using the Basic List Object Model . ………..319

Querying Lists with CAML ………..321

Querying Joined Lists ………..323

Querying Multiple Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

Throttling Queries ………..327

Introducing LINQ ………..329

LINQ Overview . ………..330

Understanding LINQ Language Elements . ………..331

Working with LINQ to SharePoint . ………..335

Generating Entities with SPMetal ………..335

Querying with LINQ to SharePoint . ………..340

Adding, Deleting, and Updating with LINQ to SharePoint . ……….. 342

Working with Document Libraries ………..344

Using the Basic Library Object Model ………..344

Working with Open XML ………..347

Conclusion . ………..352

10 Client-Side Programming ………..353

Understanding Client Object Model Fundamentals ………..353

Understanding Contexts . ………..355

Loading and Executing Operations ………..356

Working with the Managed Client Object Model ………..359

Handling Errors ………..359

Understanding Authentication and Authorization ………..362

Creating, Updating, and Deleting . ……….. 364

Working Asynchronously . ……….. 367

Working with the Silverlight Client Object Model . ………..368

Introducing Silverlight Development . ………..368

Asynchronous Programming with Silverlight . ………..371

Error Handling in Silverlight . ………..374

Passing Parameters to Silverlight ………..374

Creating a Custom Silverlight Host . ………..376

Working with the JavaScript Client Object Model . ………..378

Setting Up a Basic Page ………..378

Handling Errors in the JavaScript Client Object Model . ………..380

Running Code on Page Load ………..382

Debugging JavaScript ……….. 382

Working with AJAX ………..382

Using Object-Oriented JavaScript . ………..384

Working with JQuery ………..387

Working with WCF Data Services……….. 388

Getting Started with WCF Data Services . ………..389

Using WCF Data Services in Visual Studio . ……….. 390

Conclusion . ………..391

11 Creating and Developing Workflows………. 393

What Is Workflow? . ………. 393

SharePoint Workflow Fundamentals 395

The User Experience in a SharePoint………. Workflow ……….. 397

Creating Custom Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399

SharePoint Designer 2010 ……….399

Getting Started . ……….400

Creating a Workflow with Visio and SharePoint Designer . ……….409

Developing Custom Workflow Components . ………. 417

Developing Custom Actions . ……….419

Developing Custom Workflow Templates . ……….426

Conclusion . ……….453

12 SharePoint Security………. 455

Authentication, Authorization, and Identities . ……….455

User Information List . ……….458

Users and Groups . ……….459

Application Pool Identities . ………. 462

SharePoint System Account . ………. 462

Delegating User Credentials ……….466

User Impersonation with the User Token . ………. 467

Securing Objects with SharePoint . ……….468

Rights and Permission Levels . ………. 469

Handling Authorization Failures with SPUtility ……….472

Claims-Based Security . ……….473

Claims Architecture . ……….475

User Claims ……….476

Custom Claims Providers ……….479

Conclusion . ………. 484

13 Business Connectivity Services ……….. 485

Introducing Business Connectivity Services ………..486

Creating Simple BCS Solutions . ……….. 488

Creating External Content Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488

Creating External Lists ……….. 491

Understanding External List Limitations ………..493

Understanding BCS Architecture ……….. 495

Understanding Connectors ………..495

Understanding Business Data Connectivity ………..496

Managing the BDC Service . ………..497

Understanding the BDC Server Runtime . ………..500

Understanding the Client Cache . ………..500

Understanding Office Integration Runtime ………..501

Introducing the Secure Store Service . ………..501

Understanding Package Deployment ………..504

Understanding Authentication Scenarios ………..504

Configuring Authentication Models . ……….. 504

Accessing Claims-Based Systems ………..508

Accessing Token-Based Systems . ……….. 509

Managing Client Authentication . ……….. 509

Creating External Content Types . ……….. 510

Creating Operations ………..511

Creating Relationships ………..513

Defining Filters . ………..515

Using ECTs in SharePoint 2010 . ………..516

Creating Custom Forms ………..516

Using External Data Columns ………..517

External Data Web Parts . ………..518

Creating a Profile Page ………..519

Searching External Systems ………..520

Supplementing User Profiles . ………..521

Using ECTs in Office 2010……….. 522

Using the SharePoint Workspace ………..522

Understanding Outlook Integration . ………..523

Using Word Quick Parts ………..524

Creating Custom BCS Solutions ………... 525

Using the BDC Runtime Object Models . ……….. 525

Using the Administration Object Model ………..528

Creating .NET Assembly Connectors ………..531

Conclusion ………... 534

14 Enterprise Content Management ……….535

ECM in SharePoint Server 2010 ……….535

“Featurization” of ECM Capabilities for Wide Use . ……….536

ECM Site Templates . ……….536

Document Management . ……….537

Large Lists ……….537

Check-in/Checkout ……….539

Document Sets . ……….540

Document IDs . ……….547

Records Management………. 550

Declaring Records ……….550

Content Organizer . ……….551

Web Content Management ……….552

Page Rendering Process ……….552

Creating New Page Types . ……….554

Content Aggregation with the Content Query Web Part . ……….557

Managed Metadata ……….559

Term Sets . ……….560

Enterprise Content Types ……….567

Conclusion . ……….568

15 SharePoint Search ……….. 569

Introducing Search-Based Applications . ………..570

Understanding Search Architecture ………..571

Understanding the Search Service Application ………..572

Understanding the Indexing Process . ………..573

Understanding the Query Process ………..574

Introducing Search Web Parts . ………..574

Introducing the Search Object Models ………..575

Creating Ranking Models ………..575

Creating a Custom Ranking Model . ………..577

Using a Custom Ranking Model ………..580

Customizing Search Centers . ………..581

Adding New Tabs . ……….. 582

Customizing Search Core Results ………..583

Working with Keyword Query Syntax ………..588

Working with SQL Full-Text Search . ………..589

Creating .NET Assembly Connectors for Search . ……….. 590

Search-Enabling a Model ………..590

Implementing Security in Search Results ………..593

Crawling the .NET Assembly Connector ………..596

Conclusion . ………..596

Introduction

The purpose of this book is to help you design and develop custom business solutions for SharePoint 2010 which includes the two products SharePoint Foundation and SharePoint Server 2010. Our goal is to teach you how to create, debug, and deploy the fundamental building blocks such as Features, Pages, Web Parts, Site Columns, Content Types, Event Handlers, and Workflow Templates. Once you apply yourself and become comfortable developing with these building blocks, there’s no limit to the types of applications and solutions you can create on the SharePoint 2010 platform.

Who This Book Is For

This book is written for experienced Windows developers who are proficient with Visual Studio, the Microsoft .NET Framework, and ASP.NET. The code samples in this book are written in C# and have been created to provide a comprehensive overview of the projects you can create for SharePoint 2010..Our primary audience for this book is software developers and architects looking for expert guidance on designing and developing business applications on this platform. Developers who are new to the SharePoint platform as well as experienced SharePoint developers will benefit from this book.

System Requirements

You’ll need the following hardware and software to build and run the code samples for this book:

· Microsoft Windows Server 2008 or Microsoft Windows Server 2008 R2

o The operating system can be installed natively or on a Virtual Machine (VM)

o For a native installation, we recommend at least 4 GB of RAM

o For an installation on a VM, we recommend 8 of RAM on the most machine

· Microsoft SharePoint Foundation or SharePoint Server 2010

· Microsoft Visual Studio 2010

· Microsoft SharePoint Designer 2010

· Microsoft Office Visio 2010

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 users and IT Pros, but it’s also doing extremely well with developers. This is in part due to the significant advances in the platform, but also in the great tooling that Visual Studio 2010 has introduced.

Platform capabilities and tooling combined make SharePoint one of the most compelling collaborative platforms in the market today; a platform where many projects seek out custom development. Platform capabilities and tooling, though, are just the foundation; to truly build boundless solutions using SharePoint requires a solid understanding of how you can apply those capabilities. And as you embark on your custom development projects with SharePoint, it’s important to get the right training and insight into the platform to ensure you not only understand what you can exploit in SharePoint 2010 but also how you can build and deploy compelling solutions.

If you’re picking up this book, you’ve probably got more than a casual interest in SharePoint; you’re likely ready to begin or are already actively engaged in SharePoint development. SharePoint 2010 offers so much for the developer, ranging from sandboxed solutions, new data modeling and management capabilities, improved user experience programmability, workflow, line-of-business integration, security, to enterprise content management, and much, much more. And to provide you with a clear, concise breakdown of each of these areas and to help you build the professional-grade solutions you need to build, I can’t think of anybody better than Ted, Andrew and Scot to deliver this to you. No matter where you are in your SharePoint development career, Inside 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 a significant shift enabling you to more easily build and deploy great solutions on what is one of the best collaborative platforms in the market today. And in the true spirit of the Inside series, with this book you’ll get a deep look into the innards of SharePoint 2010; it’s one of the core books you’ll keep on your shelf as a reference that will eventually become dog-eared and tabbed from overuse.

Enjoy Inside Microsoft SharePoint 2010, and best of luck in your SharePoint development!

Steve Fox

Director, Developer & Platform Evangelism

Microsoft

From Chapter 1, SharePoint 2010 Developer Roadmap

Unless you’ve been hiding under a rock or programming in the clouds, you’ve probably noticed that Microsoft SharePoint technologies have become popular. Over the last few years, IT professionals throughout the industry—including many people at Microsoft—have been surprised by the accelerated adoption rate of SharePoint and its impressive sales revenue, which is over a billion dollars.

It is safe to say that SharePoint technologies have made it into the mainstream of software products used by companies and organizations around the world. Today, millions of people work with SharePoint technologies every day, including business users, power users, executives, site administrators, farm administrators, and professional developers.

Microsoft has released four versions of SharePoint technologies, which are listed in Table 1-1. Each SharePoint release has included an underlying core infrastructure product and a second product that adds business value to the infrastructure. The core infrastructure product has always been free to customers who already have licenses for the underlying server-side operating system, Microsoft Windows Server. Microsoft makes money on SharePoint technologies 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 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 creation of sites and lists by adding records to a static set of database tables. This initial version of SharePoint had a couple noteworthy shortcomings. First, it was cumbersome to customize sites. Second, the files uploaded to a document library were stored on the local file system of the front-end Web server, which made it impossible to scale out SharePoint Team Services sites using a farm of front-end Web servers.

SharePoint 2003 was the first version to be implemented on top of the Microsoft .NET Framework and ASP.NET. This version began to open new opportunities for professional developers looking to extend the SharePoint environment with Web Parts and event handlers. Also in this version, Microsoft altered the implementation for document libraries to store files inside a back-end SQL Server database, which made it possible to scale out SharePoint sites using a standard farm of front-end Web servers.

SharePoint 2007 introduced many new concepts to the underlying SharePoint architecture, including site columns, content types, and features and solution packages. Microsoft also improved the integration of SharePoint with ASP.NET, which made it possible for .NET developers to extend SharePoint sites by creating familiar ASP.NET components such as master pages, user controls, navigation providers, authentication providers, and custom HttpModule 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 book is to build your high-level understanding of SharePoint Foundation from the viewpoint of a professional developer. Along the way, you will learn how SharePoint Server 2010 extends SharePoint Foundation to add extra functionality and business value.

SharePoint Foundation represents different things to different people. To users, SharePoint Foundation provides the infrastructure for Web-based business solutions that scale from simple team collaboration sites to enterprise-level applications. To site collection administrators, SharePoint Foundation provides the capability to customize sites by adding lists and document libraries and by customizing many aspects of a site’s appearance through the browser or by using a customization tool such as SharePoint Designer 2010.

To a company’s IT staff, SharePoint Foundation provides a scalable and cost-effective solution for provisioning and managing a large number of sites in a Web farm environment. It also provides a reliable mechanism to roll out applications and to version these applications over time.

To a developer, SharePoint Foundation represents a rich development platform that adds value on top of the underlying ASP.NET platform. Developers build software solutions targeting SharePoint Foundation using features and components such as Web Parts, event handlers, and workflows. Now that you’ve studied the SharePoint developer roadmap and made it through our PowerShell boot camp, you’re ready to dive into the fundamentals of SharePoint Foundation development.