Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook
Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook
Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook
Ebook646 pages3 hours

Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook

Rating: 0 out of 5 stars

()

Read preview

About this ebook

This book follows a step-by-step approach to learning the building blocks of SharePoint application development. This book focuses on SharePoint 2010 development using Visual studio 2010. The book provides a hands-on approach to solving problems and creating business solutions for enhancing SharePoint 2010 environment. This book is for .NET developers to understand the building blocks for SharePoint 2010. Although the book can be used by beginners, it is recommended to have understanding of the previous versions of SharePoint. Developing SharePoint solutions needs solid understanding of ASP.NET architecture. The book assumes that the reader is familiar with ASP.NET technology and development concepts.
LanguageEnglish
Release dateSep 23, 2011
ISBN9781849684590
Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook

Related to Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook

Related ebooks

Information Technology For You

View More

Related articles

Reviews for Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Microsoft SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook - Balaji Kithiganahalli

    Table of Contents

    Microsoft SharePoint 2010 Development with Visual Studio 2010: Expert Cookbook

    Credits

    About the Author

    Acknowledgement

    About the Reviewers

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    Why Subscribe?

    Free Access for Packt account holders

    Instant Updates on New Packt Books

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code for this book

    Errata

    Piracy

    Questions

    1. Lists and Event Receivers

    Introduction

    Validating data when an item is added to a list

    Getting ready

    How to do it…

    How it works...

    There's more...

    More information – Event Receivers base class

    Debugging Event Receivers

    Developer Dashboard

    See also

    Adding a custom error message to the Event Receiver

    Getting ready

    How to do it...

    How it works...

    There's more...

    More information – How to get field names

    See also

    Adding an Application Page to an Event Receiver

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Working with List Event Receiver

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Deploying Event Receivers

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating a Feature Receiver

    Getting ready

    How to do it...

    How it works...

    See also

    Debugging a Feature Receiver

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Debugging Feature Installed Events

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    2. Workflows

    Introduction

    Creating a sequential workflow

    Getting ready

    How to do it…

    How it works...

    There's more...

    See also

    Creating a site workflow with an initiation form

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Deploying an InfoPath form with the workflow

    Getting ready

    How to do it...

    How it works...

    See also

    Creating a task from the workflow

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating a custom task form

    Getting ready

    How to do it...

    How it works...

    There's more...

    Task delete

    See also

    3. Advanced Workflows

    Introduction

    Creating a custom activity

    Getting ready

    How to do it...

    How it works...

    There's more...

    Workflow security

    Sandboxed activities

    See also

    Creating a custom activity for a sandboxed solution

    Getting ready

    How to do it...

    How it works...

    See also

    Creating a state machine workflow

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Adding a custom workflow status

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating a pluggable workflow service

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    4. List Definitions and Content Types

    Introduction

    Creating a site column

    Getting ready

    How to do it…

    How it works...

    There's more...

    Deleting the site columns on deactivation of the feature

    See also

    Extending an existing content type

    Getting ready

    How to do it...

    How it works...

    There's more...

    Deployment of previous solution

    Inherits attribute in content type

    See also

    Creating custom content type using an object model

    Getting ready

    How to do it...

    How it works...

    See also

    Associating a document template with the content type

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Associating a workflow to a content type

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating an external content type

    Getting ready

    How to do it...

    How it works...

    There's more...

    Create, update, and delete methods

    Connection strings

    See also

    Creating a list definition

    Getting ready

    How to do it...

    How it works...

    See also

    5. Web Parts

    Introduction

    Creating a visual web part

    Getting ready

    How to do it…

    How it works...

    There's more...

    Visual web parts and sandboxed solution

    Web Parts Gallery

    See also

    Creating a code-only web part (sandboxed solution)

    Getting ready

    How to do it...

    How it works...

    There's more...

    Deployment of web parts

    Versioning of web parts

    See also

    Creating AJAX enabled web parts

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Adding configuration properties to web parts

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating connectable web parts

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating a Silverlight web part

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    6. Web Services and REST

    Introduction

    Getting data through REST

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Filtering list data

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Fiddling with Fiddler

    Getting ready

    How to do it...

    How it works...

    See also

    Creating a REST consumer

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Inserting new contacts through REST

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Creating a custom SharePoint WCF service

    Getting ready

    How to do it...

    How it works...

    There's more...

    Creating a client application to consume the custom WCF service

    See also

    7. Working with Client Object Model

    Introduction

    Creating a list using a Managed OM

    Getting ready

    How to do it…

    How it works...

    There's more...

    Impersonation

    See also

    Handling exceptions

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Calling Object Model asynchronously

    Getting ready

    How to do it...

    How it works...

    See also

    Using JavaScript Object Model

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Using a Silverlight Object Model

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Index

    Microsoft SharePoint 2010 Development with Visual Studio 2010: Expert Cookbook


    Microsoft SharePoint 2010 Development with Visual Studio 2010: Expert Cookbook

    Copyright © 2011 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: September 2011

    Production Reference: 1190911

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-84968-458-3

    www.packtpub.com

    Cover Image by Sandeep Babu (<sandyjb@gmail.com>)

    Credits

    Author

    Balaji Kithiganahalli

    Reviewers

    Wei Chung Low

    Michael Nemtsev

    Doug Ortiz

    Acquisition Editor

    Dhwani Devater

    Development Editor

    Hithesh Uchil

    Technical Editor

    Prashant Macha

    Project Coordinator

    Shubhanjan Chatterjee

    Proofreader

    Lisa Brady

    Indexer

    Tejal Daruwale

    Graphics

    Nilesh Mohite

    Production Coordinator

    Melwyn Dsa

    Cover Work

    Melwyn Dsa

    About the Author

    Balaji Kithiganahalli has been a computer nerd since 1995. He has a Master's degree in Systems Engineering and is currently serving as CEO and partner for Integrate, LLC. His company specializes in systems integration and custom software development. He has over 15 years of software development and architectural experience. He has consulted with several government and multi-national clients.

    He is a technology agnostic who used to mainly work on J2EE related technologies. Since 2003, he is mainly involved in implementing SharePoint and .NET technologies. He is currently architecting SharePoint 2010 implementation for a very large government organization in Atlanta, GA.

    When not working, he enjoys going for bike rides with his kids and reading books about other technologies. He currently lives in Atlanta, GA with his beautiful wife and two kids.

    Acknowledgement

    Every journey begins with a first step; this is true in my case as it is my first book. This journey of mine would not have been successful if it was not for the support of my family and many of my friends. I am truly blessed with such wonderful family and friends.

    First and foremost, I'd like to thank my mom, dad, and brother for their wonderful support and encouragement in every step of the way and providing moral support when needed. I would also like to thank my lovely wife Vanishree and kids Veda and Amit for their patience, support, and understanding without which I would have never been able to complete this book. Next, I would like to thank my technical reviewers. You guys did an awesome job. Your insight and input has increased the overall value of this book.

    I would also like to thank my publisher Packt Publishing, and the many fine people such as Dhwani, Shubhanjan, Hithesh, and Prashant for their valuable input and patience. You guys ROCK! I guess I owe you guys a beer when you are here in Atlanta.

    Writing a book is a lot of work and is time-consuming. Even though I am the only author on this book, there are many people who are involved in making this book a finished product for the readers. While I may not come in contact with many of these folks, I would like to thank them and certainly appreciate their work and effort.

    About the Reviewers

    Wei Chung, Low a Technical Lead in BizTalk and .NET and a MCT, MCPD, MCITP, MCTS, MCSD.NET, works with ResMed (NYSE: RMD), at its Kuala Lumpur, Malaysia campus. He is also a member of PMI, certified as a PMP. He started working on Microsoft .NET in his early career and has been involved in development, consultation, and corporate training in the area here of business intelligence, system integration, and virtualization. He previously worked for the Bursa Malaysia (formerly Kuala Lumpur Stock Exchange) and Shell IT International, which provided him with rich integration experience across different platforms.

    He strongly believes that great system implementation delivers precious value to business, and the integration of various systems across different platforms shall always be a part of it. Just like how people from different cultures and diversities are used to living together in most of the major cities, in harmony.

    Doug Ortiz is an independent consultant whose skillset encompasses multiple platforms such as .Net, SharePoint, Office, and SQL server.

    He possesses a Master's degree in Relational Databases and has over 20 years of experience in Information Technology. Of those years of experience, half are within .Net and SharePoint. His roles have ranged from Architecture, Implementation, Administration, Disaster Recovery, Migrations, Development, and Automation of Information Systems; in and outside of SharePoint.

    He is the founder of Illustris, LLC and can be reached at: <dougortiz@illustris.org>.

    Interesting aspects of his profession:

    Doug has experience in integrating multiple platforms and products with the purpose of sharing data.

    He has improved, salvaged, and architected projects by utilizing unique and innovative techniques.

    His hobbies include Yoga and Scuba Diving.

    I would like to thank my wonderful wife Mila for all her help and support as well as Maria and Nikolay.

    I would also like to thank everyone at Packt Publishing for their encouragement and guidance.

    Michael Nemtsev is an ex-Microsoft MVP in .NET/C# and SharePoint Server 2010 and has held that status between the years 2005 and 2011.

    Michael's expertize are in Enterprise Integration and Platform and Collaboration areas and currently he is working as a Senior Consultant at Microsoft in Sydney, Australia helping clients to improve business collaboration with SharePoint 2010 and Office365.

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    You might want to visit www.PacktPub.com for support files and downloads related to your book.

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

    http://PacktLib.PacktPub.com

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read, and search across Packt's entire library of books.

    Why Subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print and bookmark content

    On demand and accessible via web browser

    Free Access for Packt account holders

    If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

    Instant Updates on New Packt Books

    Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.

    Preface

    Microsoft SharePoint 2010 is the best-in-class platform for content management and collaboration. With Visual Studio, developers have an end-to-end business solutions development IDE. To leverage this powerful combination of tools it is necessary to understand the different building blocks of SharePoint. This book will provide necessary concepts and present ways to develop complex business solutions and take them further.

    SharePoint 2010 Development with Visual Studio 2010 Expert Cookbook is an instructional guide for developing, debugging and deploying applications for SharePoint 2010 environment using Visual Studio 2010. The cookbook approach helps you to dip into any recipe that interests you or you can also read it from cover to cover if you want to get hands on with the complete application development cycle.

    With this book you will learn to develop event handlers, workflows, content types, web parts, client object model applications, and web services for SharePoint 2010 in an instructional manner. You will discover the less known facts behind debugging feature receivers, deployment of web parts, utilizing free toolkits to enhance the development and debugging experience.

    You will learn the newer development approach called Visual Web Parts and how to develop and deploy Silverlight applications that can be used with Silverlight web parts. You will also explore the SandBoxed deployment model and its usage. You will create your own web services for SharePoint and learn more about the Client Object Model introduced in SharePoint 2010. All in all, you will develop SharePoint solutions in an instructional manner that eases the learning process.

    What this book covers

    Chapter 1, List and Event Receivers: Event Receivers are used for responding to events raised by SharePoint on lists, features, list items, and so on. This chapter not only provides an overview of the event receivers that can be developed using Visual Studio 2010, but also guides you through the step-by-step process of creating them and applying them to real world scenarios.

    Chapter 2, Workflows: In this chapter, you will learn about sequential workflows, site workflows, and deploying custom initiation forms with workflows using ASPX pages and InfoPath forms. You will also learn to create custom InfoPath task forms with the workflows.

    Chapter 3, Advanced Workflows: In this chapter, you will learn Advanced Workflow topics such as creating custom activity for both sandboxed and non-sandboxed environments. You will not only learn how to create state machine workflows but also to model them. This chapter also guides you through the process of creating a Pluggable workflow service. Last but not least, this chapter also guides you through the process of changing workflow statuses.

    Chapter 4, List Definitions and Content Types: In this chapter, we will discover the world of content types. We will use object models to create content types, add new columns, document templates, and workflows to content types using Visual Studio 2010. This chapter also guides you through the process of creating external content types that are linked to external data source such as the SQL Server database. In the end of the chapter, we will also learn how to create list definitions using Visual Studio.

    Chapter 5, Web Parts: In this chapter, we will discover visual web parts, code-only web parts, AJAX enabled web parts, and Silverlight web parts. The chapter also provides details on connectable web parts and adding configuration properties to web parts. This chapter also provides detailed information on versioning and deployment of web parts.

    Chapter 6, Web Services and REST: In this chapter, we will learn about using REST services to extract data from SharePoint. We will create client applications that make use of REST to extract data from SharePoint. We will also learn to create custom SharePoint WCF web services.

    Chapter 7, Working with Client Object Model: SharePoint 2010 introduced the new Client Object Model which can be used to create client applications that use SharePoint as a backend data store. In this chapter, we will learn all the three client object models such as the managed object model, the JavaScript object model, and the Silverlight object model. We will also learn the exception handling techniques and asynchronous calling of these object models.

    What you need for this book

    This book presents a series of projects that demonstrates the features of SharePoint 2010 and Visual Studio 2010. In order to gain hands on experience of these features, it is recommended that you have a 64-bit Windows development machine with lots of memory. Chapter 1, List and Event Receivers of this book provides the list of software and links that you can refer to set up your development environment. If you do not have a license for this software, you can always get the trial version from the Microsoft website.

    Alternatively, you can read through this book without working through the projects. There are plenty of screenshots that provide a good sense of how these solutions work. This is not a suitable approach for beginner programmers.

    Who this book is for

    This book is for .NET developers to understand the building blocks of SharePoint 2010. Although the book can be used by beginners, it is recommended that the readers have an understanding of the previous versions of SharePoint. Developing SharePoint solutions requires solid understanding of ASP.NET architecture. The book assumes that the reader is familiar with ASP.NET technology and development concepts.

    Conventions

    In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

    Code words in text are shown as follows: We can include other contexts through the use of the include directive.

    A block of code is set as follows:

    private string GetInitiationData()

      {

        return this.txtCreditAmount.Text;

      }

    Any command-line input or output is written as follows:

    Add-SPSolution –LiteralPath

    Install-SPSolution -Identity -WebApplication

    Enable-SPFeature FeatureFolderName -Url

    New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Select File | New | Project. The new project wizard dialog box as shown will be displayed (Make sure to select .NET Framework 3.5 in the top drop-down box).

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

    To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via the subject of your message.

    If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code for this book

    You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com.

    Enjoying the preview?
    Page 1 of 1