Chapter 2. SharePoint Development with Visual Studio

In this chapter, we will cover:

  • Exploring Content Types and Site Columns
  • Features and Solutions
  • Creating new Site Columns
  • Packaging SharePoint solutions
  • Creating new Content Types
  • Creating document libraries with Content Types
  • Feature receivers
  • List event receivers
  • Feature staplers

Introduction

A critical component of SharePoint is lists - the place we store data in SharePoint. The familiar document library is a special type of list that is designed to hold (primarily) Microsoft Office document types that people collaborate on, check out / check in, edit, version, and approve. There are many other "out-of-the-box" SharePoint lists you can create such as Announcements, Contacts, Events (calendar), Tasks, and more! Lists are where we store our data in SharePoint.

You should strive to use the out-of-the-box lists wherever possible. Next you should look to leverage an out-of-the-box list by "inheriting" from it and then customizing your own columns. If you wish, you may also create your own custom list from scratch.

A list is composed of columns collectively they form the schema for the list. In SharePoint terms, the schema is called a Content Type, and the individual columns within the schema are called Site Columns. For example, the Contacts Content Type has columns such as First Name, Last Name, and E-mail. Finally, an instance of a contacts list will use/attach the contacts list content type.

If you have relational database expertise (such as with Microsoft SQL Server), the concepts introduced here will be familiar to you. Site Columns are equivalent to data types. The Data Definition Language (a script) will contain the definition / schema for a table. Running the script will create a physical table instance as determined by the schema.

Why does this chapter on SharePoint development begin with a lecture on Site Columns, Content Types, and Lists? The proper creation, deployment, and management of SharePoint lists and schema is an important focus of the professional SharePoint developer. I cannot think of a better example to introduce all of the basics in such a way that you will be returning to this chapter again and again for guidance!

We will be using the awesome Visual Studio 2010 SharePoint tools to create a custom document library for Proposals. The "Proposal" will be implemented with a Content Type (and Site Columns), and inherit from the out-of-the-box "document", and attached to the document library. We will also be exploring the practical use of more advanced techniques: Feature Receivers, Event Receivers, and Feature Staplers.

This forms one of the most common "professional" patterns for a SharePoint developer!

  1. Create Site Columns
  2. Create Content Types
  3. Create SharePoint list and attach Content Types
  4. Provision with Feature Receivers and Feature Staplers
  5. Control list events with Item Event Receivers

This chapter will walk through the components of this pattern.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.162.26