Pro SharePoint 2010 Development for Office 365 (cid:2) (cid:2) (cid:2) (cid:0) (cid:0) Bart McDonough Dave Milner Paul Stork Pro SharePoint 2010 Development for Office 365 Copyright © 2012 by Bart McDonough, Dave Milner, and Paul Stork This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. ISBN978-1-4302-4182-9 ISBN978-1-4302-4183-6 (eBook) Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. President and Publisher: Paul Manning Lead Editor: Jonathan Hassell Developmental Editor: Kate Blackham Technical Reviewer: Jim Duncan Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Louise Corrigan, Morgan Ertel, Jonathan Gennick, Jonathan Hassell, Robert Hutchinson, Michelle Lowman, James Markham, Matthew Moodie, Jeff Olson, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Gwenan Spearing, Matt Wade, Tom Welsh Coordinating Editor: Jill Balzano Copy Editor: Nancy Sixsmith, ConText Editorial Services Compositor: Bytheway Publishing Services Indexer: SPi Global Artist: SPi Global Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales. Any source code or other supplementary materials referenced by the author in this text is available to readers at www.apress.com. For detailed information about how to locate your book’s source code, go to www.apress.com/source- code. ii To my wonderful wife, Cathy, and our children Caitlin, John, and Kevin, for your patience, love, and support while I wrote this book. I love you all! –Bart McDonough iii Contents at a Glance (cid:2) Foreword...............................................................................................................xv (cid:2) About the Authors................................................................................................xvi (cid:2) About the Technical Reviewer...........................................................................xviii (cid:2) Introduction.........................................................................................................xix (cid:2) Chapter 1: Introduction to Office 365 and SharePoint Online.................................1 (cid:2) Chapter 2: SharePoint Online Development Overview.........................................17 (cid:2) Chapter 3: Setting up a Development Environment for SharePoint Online...........31 (cid:2) Chapter 4: Basic Customization Using Only a Browser........................................53 (cid:2) Chapter 5: Taking It to the Next Level with SharePoint Designer.........................73 (cid:2) Chapter 6: InfoPath and SharePoint Online........................................................103 (cid:2) Chapter 7: Custom Development with Visual Studio..........................................125 (cid:2) Chapter 8: SharePoint Designer Workflows........................................................149 (cid:2) Chapter 9: Intro to Client-Side Development......................................................171 (cid:2) Chapter 10: Client-Side Development with Silverlight........................................187 (cid:2) Chapter 11: Developing with jQuery, HTML5, and CSS3.....................................207 (cid:2) Appendix A: Hybrid On-Premise/Online Solutions..............................................229 (cid:2) Appendix B: Office 365 Preview (Office 2013)....................................................235 (cid:2) Index...................................................................................................................237 iv Contents (cid:2) Foreword...............................................................................................................xv (cid:2) About the Authors................................................................................................xvi (cid:2) About the Technical Reviewer...........................................................................xviii (cid:2) Introduction.........................................................................................................xix (cid:2) Chapter 1: Introduction to Office 365 and SharePoint Online.................................1 What Are Office 365 and SharePoint Online?....................................................................2 What’s Included in Office 365?..........................................................................................2 Plan Types in Office 365....................................................................................................3 Plan Comparison................................................................................................................4 Service Descriptions.................................................................................................................................5 Signing Up for a Trial.........................................................................................................5 Converting Your Trial to a Paid Subscription.....................................................................7 Purchasing a Paid Subscription.........................................................................................8 Purchasing Multiple Subscriptions...........................................................................................................8 How to Manage Your Account...........................................................................................8 Admin Overview Page...............................................................................................................................9 Accessing SharePoint Online...........................................................................................13 Managing SharePoint Online...........................................................................................13 Summary.........................................................................................................................15 v (cid:2)(cid:0)(cid:35)(cid:47)(cid:46)(cid:52)(cid:37)(cid:46)(cid:52)(cid:51)(cid:0) (cid:2) Chapter 2: SharePoint Online Development Overview.........................................17 Three Customization Approaches....................................................................................17 Customization Through the Browser......................................................................................................17 Customization Through Declarative Solutions and Client-Side Coding with SharePoint Designer........21 Customization Through Visual Studio 2010............................................................................................26 Client Object Model................................................................................................................................27 Customization Limitations...............................................................................................28 Sandboxed Solution Limitations.............................................................................................................28 Missing Shared Service Applications.....................................................................................................29 Summary.........................................................................................................................29 (cid:2) Chapter 3: Setting up a Development Environment for SharePoint Online...........31 Introduction.....................................................................................................................31 Goals.......................................................................................................................................................31 Hardware and Software Requirements..................................................................................................31 Virtual Machine Options..........................................................................................................................33 Advantages and Disadvantages of Virtual Machines..............................................................................34 Visual Studio 2010 Setup.................................................................................................34 Version....................................................................................................................................................34 Visual Studio 2010 SharePoint Power Tools...........................................................................................35 Visual Studio Extensions........................................................................................................................35 Resources...............................................................................................................................................35 SharePoint 2010 Local Setup..........................................................................................35 Office 365 SharePoint Unique Points......................................................................................................35 SharePoint 2010 Easy Setup Script (for Setting Up a Dev Environment)................................................36 SharePoint 2010 Setup on Windows 7...................................................................................................41 Sandboxed/User Code Service Setup.....................................................................................................42 Duplicating Your Office 365 Environment...............................................................................................42 vi (cid:2)(cid:0)(cid:35)(cid:47)(cid:46)(cid:52)(cid:37)(cid:46)(cid:52)(cid:51)(cid:0) SharePoint Designer 2010 Setup.....................................................................................42 Installation..............................................................................................................................................43 Connecting SharePoint Designer to SharePoint.....................................................................................43 Connecting to Office 365........................................................................................................................44 Setting Up a Good HTML Editor........................................................................................46 Team Development..........................................................................................................47 Common Virtual Hard Drive Images........................................................................................................47 Environments..........................................................................................................................................47 Change Control................................................................................................................51 Source Control........................................................................................................................................51 Binary Control.........................................................................................................................................51 Process...................................................................................................................................................51 Summary.........................................................................................................................52 (cid:2) Chapter 4: Basic Customization Using Only a Browser........................................53 When to Use the Browser................................................................................................53 How Broad Are the Customizations?......................................................................................................54 Who Will be Doing the Work?.................................................................................................................54 Customizing Your Site’s Look and Feel............................................................................54 Title, Description, and Icon.....................................................................................................................55 Quick Launch..........................................................................................................................................57 Top Link Bar...........................................................................................................................................59 Tree View................................................................................................................................................59 Site Theme.............................................................................................................................................60 Customizing Site Structure and Pages............................................................................62 Lists and Libraries..................................................................................................................................62 Site Pages...............................................................................................................................................68 Content Editor Web Part.........................................................................................................................68 vii (cid:2)(cid:0)(cid:35)(cid:47)(cid:46)(cid:52)(cid:37)(cid:46)(cid:52)(cid:51)(cid:0) Site Columns..........................................................................................................................................70 Site Content Types..................................................................................................................................70 Subsites..................................................................................................................................................70 Site Templates........................................................................................................................................70 Publishing-Enabled Sites.................................................................................................70 Publishing Pages....................................................................................................................................71 Customizing the Simple Public-Facing Website..............................................................71 Summary.........................................................................................................................72 (cid:2) Chapter 5: Taking It to the Next Level with SharePoint Designer.........................73 Getting Started With SharePoint Designer 2010..............................................................73 Controlling the Use of SPD 2010.............................................................................................................74 Administering a SharePoint Site......................................................................................76 Building New Websites...........................................................................................................................76 Managing Security..................................................................................................................................79 Saving a Customized Subsite as a Template..........................................................................................85 Branding..........................................................................................................................87 Changing Fonts and Colors with a Theme..............................................................................................87 Editing Pages..........................................................................................................................................87 Embedding Client-Side Code...........................................................................................88 Interacting with Data.......................................................................................................92 Customizing List and Form Views..........................................................................................................93 Data View and Data Form Web Parts......................................................................................................94 Creating Custom Ribbon Actions............................................................................................................96 Interacting with External Data.........................................................................................96 Business Connectivity Services (BCS)....................................................................................................96 The Secure Store Service.......................................................................................................................97 External Content Types...........................................................................................................................98 viii (cid:2)(cid:0)(cid:35)(cid:47)(cid:46)(cid:52)(cid:37)(cid:46)(cid:52)(cid:51)(cid:0) Building Declarative workflows.......................................................................................99 Limitations.....................................................................................................................100 Some Customizations Must Be Developed in Production.....................................................................100 No Inline Server-Side Code...................................................................................................................100 Can’t Reference Sandboxed Solution Managed Code..........................................................................100 Summary.......................................................................................................................101 (cid:2) Chapter 6: InfoPath and SharePoint Online........................................................103 Introduction...................................................................................................................103 Goals.....................................................................................................................................................103 Hardware and Software Requirements................................................................................................103 InfoPath Overview.................................................................................................................................106 InfoPath Forms Services Overview.......................................................................................................106 Where InfoPath is Used in Office 365...................................................................................................111 Administering InfoPath in Office 365.............................................................................111 Standard Lists and Libraries..........................................................................................115 Workflows and InfoPath.................................................................................................123 External Data and InfoPath............................................................................................124 Summary.......................................................................................................................124 (cid:2) Chapter 7: Custom Development with Visual Studio..........................................125 When to Use Visual Studio for Customization................................................................126 Have You Exceeded What You Can Do in the Browser and SharePoint Designer?...............................126 Who Will Be Doing the Work?...............................................................................................................126 How Reusable Do the Customizations Need to Be?.............................................................................126 Preparing Visual Studio for SharePoint Online Development.........................................127 Setting Up Your Development Environment..........................................................................................127 Extending Visual Studio........................................................................................................................127 Creating a Project..........................................................................................................127 ix (cid:2)(cid:0)(cid:35)(cid:47)(cid:46)(cid:52)(cid:37)(cid:46)(cid:52)(cid:51)(cid:0) Restrictions of the Sandboxed Environment..................................................................129 Sandboxed Solutions............................................................................................................................129 Packaging and Installation...................................................................................................................129 Restrictions...........................................................................................................................................130 Split Page Rendering System...............................................................................................................131 Creating a Feature and Adding a Feature Receiver.......................................................131 Creating a Feature................................................................................................................................131 Adding a Feature Receiver...................................................................................................................132 Creating a Web Part.......................................................................................................133 Creating a Module to Deploy Files.................................................................................136 Creating an Event Receiver............................................................................................137 Creating a Content Type................................................................................................139 Adding Fields to Your Content Type......................................................................................................140 Creating a List Definition...............................................................................................141 Creating a Custom Action..............................................................................................142 Packaging and Deploying Your Solution........................................................................143 Prepare Your Features..........................................................................................................................143 Preparing the Solution Package...........................................................................................................143 Set Your Build Configuration................................................................................................................144 Deploy Your Solution to SharePoint Online...........................................................................................144 Tips and Recommendations..........................................................................................146 Organize Your Projects in a Logical Manner.........................................................................................146 Don’t Be Afraid to Change Namespaces...............................................................................................147 Logging.................................................................................................................................................147 Summary.......................................................................................................................147 (cid:2) Chapter 8: SharePoint Designer Workflows........................................................149 Introduction to Workflows in SharePoint Online............................................................149 x