Upload
duongtuong
View
215
Download
1
Embed Size (px)
Citation preview
Wrox Programmer to Programmer™Join the discussion @ p2p.wrox.com
BeginningSharePoint® 2010 Development
Steve Fox
Fox
$39.99 USA $47.99 CAN Programming (.NET/C) / Microsoft Office 2010
Put the power of SharePoint 2010 into practice
wrox.comProgrammer ForumsJoin our Programmer to Programmer forums to ask and answer programming questions about this book, join discussions on the hottest topics in the industry, and connect with fellow programmers from around the world.
Code Downloads Take advantage of free code samples from this book, as well as code samples from hundreds of other books, all ready to use.
Read More Find articles, ebooks, sample chapters and tables of contents for hundreds of books, and more reference resources on programming topics that matter to you.
As a first-class platform that has evolved significantly since its previous release, SharePoint 2010 now provides several advancements for the developer (native Visual Studio tools support, services and extensibility enhancements, and APIs), and many new capabilities (improved data programmability, line-of-business interoperability, and sandboxed solutions). With this authoritative guide, industry veteran Steve Fox provides expert guidance on developing applications as he walks you through the fundamentals of programming, explores the developer toolset, and provides practical code examples to teach you how to use many of SharePoint’s new developer features. You’ll quickly discover how SharePoint’s rich platform supports great collaboration, extensibility, and interoperability.
Beginning SharePoint 2010 Development:
• Guides you through the creation of your first SharePoint 2010 application
• Addresses working with SharePoint 2010 sites, lists, and Web parts
• Describes developing SharePoint applications using SharePoint Designer 2010
• Reviews standard and Visual Web parts, as well as data view Web parts
• Details integrating SharePoint with Microsoft® Office
• Explains how to secure your SharePoint 2010 applications
Steve Fox is a Technical Evangelist in the Developer Platform Evangelism group at Microsoft. He presents at many conferences and has written numerous articles.
Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
SharePoint® 2010 D
evelopment
Beginning
Get more out of wrox.com
Programmer to Programmer™
InteractTake an active role online by participating in our P2P forums @ p2p.wrox.com
Wrox Online LibraryHundreds of our books are available online through Books24x7.com
Wrox Blox Download short informational pieces and code to keep you up to date and out of trouble!
Join the CommunitySign up for our free monthly newsletter at newsletter.wrox.com
BrowseReady for more Wrox? We have books and e-books available on .NET, SQL Server, Java, XML, Visual Basic, C#/ C++, and much more!
Contact Us. We always like to get feedback from our readers. Have a book idea? Need community support? Let us know by e-mailing [email protected]
Related Wrox BooksBeginning SharePoint 2010 Administration: Windows SharePoint Services 4 and Microsoft SharePoint Server 2010 978-0-470-59712-5Packed with step-by-step instructions, tips and tricks, and real-world examples, this book dives into the basics of how to install, manage, and administrate SharePoint 2010 in an effective and secure manner.
Beginning SharePoint 2010: Building Team Solutions with SharePoint 978-0-470-61789-2Beginning SharePoint 2010: Building Team Solutions with SharePoint provides you with extensive knowledge and expert advice, empowering you to become a SharePoint champion within your organization.
Beginning Microsoft SharePoint Designer 2010 978-0-470-64316-7Covering both the design and business applications of SharePoint Designer, this complete Wrox guide brings you thoroughly up to speed on how to use SharePoint Designer in an enterprise.
Professional SharePoint 2010 Administration 978-0-470-53333-8Written by a team of SharePoint experts, this book covers installation, upgrading, configuration, architecture and capacity planning, monitoring, backups, and disaster recovery.
Professional SharePoint 2010 Branding and User Interface Design 978-0-470-58464-4SharePoint allows influence over key branding issues like site design, how the user interface affects site visitors’ experience, ease of use, and other branding topics. This book, from a team of SharePoint branding experts, covers it all.
Professional SharePoint 2010 Development 978-0-470-52942-3This comprehensive book shows readers how to build field-tested solutions and create custom content management applications.
Professional Microsoft FAST Search: Customizing, Designing, and Deploying Search for SharePoint 2010 and Internet Servers 978-0-470-58466-8FAST is Microsoft’s intelligent search-based technology that boasts an ability to integrate business intelligence with Search. This guide provides you with advanced coverage on FAST search and shows you how to use it to plan, customize, and deploy your search solution, with an emphasis on SharePoint 2010 and Internet-based search solutions.
Real World SharePoint 2010: Indispensable Experiences from 20 SharePoint MVPs 978-0-470-59713-2Containing contributions from nearly a score of SharePoint MVPs, this book is an anthology of best practices for all areas of SharePoint 2010.
BEGINNING SharEPoINt 2010 DEVELoPMENt
INtroDuctIoN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xxiii
Part ⊲ I WELcoME to SharEPoINt 2010
Introduction to SharePoint 2010chaPtEr 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Getting Started with SharePoint 2010 DevelopmentchaPtEr 2 . . . . . . . . . . . . . . . . . 25
Part I ⊲ I GEttING StartED WIth SharEPoINt 2010 DEVELoPMENt
SharePoint 2010 Developer ToolschaPtEr 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Common Developer Tasks in SharePoint 2010chaPtEr 4 . . . . . . . . . . . . . . . . . . . . . . 129
Programming Against SharePoint 2010 ListschaPtEr 5 . . . . . . . . . . . . . . . . . . . . . . . . 159
Building and Deploying SharePoint chaPtEr 6 Web Parts . . . . . . . . . . . . . . . . . . . . . . 217
Creating Your First SharePoint 2010 ApplicationchaPtEr 7 . . . . . . . . . . . . . . . . . . . . .249
Part II ⊲ I aDVaNcED toPIcS for SharEPoINt 2010 DEVELoPMENt
Integrating Line-of-Business Data Using chaPtEr 8
Business Connectivity Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .277
Creating Enhanced User Experiences for SharePoint chaPtEr 9
with Silverlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Developing Service-Oriented Applications for SharePoint 2010chaPtEr 10 . . . . . . .363
Integrating SharePoint with Microsoft OfficechaPtEr 11 . . . . . . . . . . . . . . . . . . . . . . . .399
Securing Your SharePoint 2010 ApplicationschaPtEr 12 . . . . . . . . . . . . . . . . . . . . . . . .433
Part ⊲ IV aPPENDIx
Where to Go from HereaPPENDIx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .449
INDEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451
584637ffirs.indd 1 5/3/10 10:41:36 AM
Beginning SharePoint® 2010 Development
Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-0-470-58463-7 ISBN: 978-0-470-88182-8 (ebk) ISBN: 978-0-470-88183-5 (ebk) ISBN: 978-0-470-90477-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 specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-motional 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 pub-lisher 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: 2010926824
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 affiliates, in the United States and other coun-tries, 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.
584637ffirs.indd 6 5/3/10 10:41:36 AM
aBout thE author
StEVE fox of Redmond, WA, is a Senior Technical Evangelist in the Developer Platform Evangelism group at Microsoft. He’s worked in the IT industry for more than 15 years, and has worked in the areas of natural language, search, developer tools, and, more recently, Office Business Application and SharePoint development. Fox also presents at both domestic and international conferences (such as TechEd, PDC, DevConnections, and SAP TechEd, among others), and has written a number of books such as Professional SharePoint 2007 Development using Silverlight 2 (Indianapolis: Wiley, 2009) and Microsoft .NET and SAP (Redmond, WA: Microsoft Press, 2009), as well as articles for MSDN Magazine and other technical magazines.
584637ffirs.indd 9 5/3/10 10:41:36 AM
aBout thE tEchNIcaL EDItorS
DarrIN BIShoP is a speaker, author, and developer focusing on Microsoft SharePoint Technologies. He is the president and lead developer for Darrin Bishop Group, Inc., a Midwest-based Microsoft Partner focusing on SharePoint Technologies, portals, and collaboration. He is the author of The Rational Guide to Building SharePoint Web Parts (Greenland, N.H: Rational Press, 2008), as well as several articles in various magazines. Bishop is an international speaker and speaks at many SharePoint conferences, SharePoint Saturdays, MOSS Camps, and User Groups. He has been work-ing with SharePoint Technologies since the release of SharePoint Portal Server 2001.
ELI roBILLarD designs and guides the delivery of global SharePoint solutions as a Principal Architect at Infusion Development Corporation. He is a SharePoint Server MVP, a co-author of Professional SharePoint 2007 Development (Indianapolis: Wiley, 2007), founder of the Toronto SharePoint Users Group, co-chair of the Toronto SharePoint Camp, and past chair of a group of high-profile industry influencers and early-adopters known as the ASPInsiders. Robillard lives in Toronto, Ontario, Canada where he also plays music and goes on adventures with Dawn, Irina, and their dog, Dakota.
KENNEth SchaEfEr is an independent developer and designer focusing on SharePoint and Web-based solutions.
BrENDoN SchWartz has worked in the Atlanta area User Group scene, and is known around town as one of the Atlanta .NET Regular Guys (www.devcow.com). He is currently on the INETA Board of Directors as the Vice President of Technology, and is a Microsoft MVP for ASP.NET. Today, Brendon works to solve real-world business problems with Microsoft technologies, such as SharePoint, Office, BizTalk, VSTS, and .NET technologies. In addition to presenting at local User Groups, he helped create the “Free Training 1,2,3!” series (www.freetraining123.com) to help developers learn Microsoft technologies. He presented material at the first SharePoint 1,2,3! event (www.sharepoint123.com), along with other members of the Atlanta Microsoft Professionals. Schwartz has helped on the leadership teams of five different User Groups. At the first Atlanta Code Camp in 2005, he presented material on ASP.NET mobile controls.
584637ffirs.indd 11 5/3/10 10:41:36 AM
crEDItS
acquISItIoNS EDItorPaul Reese
ProjEct EDItorKevin Shafer
tEchNIcaL EDItorSDarrin BishopEli RobillardKen SchaeferBrendon Schwartz
ProDuctIoN EDItorEric Charbonneau
coPy EDItorFoxxe Editorial
EDItorIaL DIrEctorRobyn B . Siesky
EDItorIaL MaNaGErMary Beth Wakefield
aSSocIatE DIrEctor of MarKEtINGDavid Mayhew
ProDuctIoN MaNaGErTim Tate
VIcE PrESIDENt aND ExEcutIVE GrouP PuBLIShErRichard Swadley
VIcE PrESIDENt aND ExEcutIVE PuBLIShErBarry Pruett
aSSocIatE PuBLIShErJim Minatel
ProjEct coorDINator, coVErLynsey Stanford
coMPoSItorJeff Lytle, Happenstance Type-O-Rama
ProofrEaDErBeth Prouty, Word One
INDExErJohnna VanHoose Dinse
coVEr DESIGNErMichael E . Trent
coVEr IMaGE
© Slobo Mitic/istockphoto
584637ffirs.indd 13 5/3/10 10:41:36 AM