SharePoint Project and Project Item Templates

Visual Studio 2010 provides several new project type templates and project item templates for developing SharePoint sites and applications.

To view the SharePoint 2010 project templates in Visual Studio, expand the SharePoint node under either Visual Basic or Visual C#, and then click 2010. To view the SharePoint 2007 project templates, click the 2007 folder.

When you create a SharePoint project in Visual Studio, an Empty SharePoint Project is created (see later this in topic) together with the files that are required by that project type. Project item templates are used to add project items to an existing SharePoint project, such as adding an event receiver to a list definition project.

For information about SharePoint fundamentals, see SharePoint Foundation Building Blocks.

Following is a list of SharePoint project templates. To create a SharePoint project, click File, point to New, select a project template in the New Project dialog box, and then click OK.

Business Data Connectivity Model

Business Data Connectivity Model projects let you integrate business data into SharePoint. Business data can come from back-end server applications, such as SQL Server, Siebel, and SAP. A Business Data Connectivity Model project is an Empty SharePoint Project that contains a Business Data Connectivity Model item. For more information, see Integrating Business Data into SharePoint and What's New: Business Connectivity Services.

Content Type

Content Type projects let you create custom content types based on an existing (base) content type such as a document, announcement, or a task. The custom content type provides the same attributes and fields as the base content type together with any fields you define.

NoteNote

Due to a SharePoint limitation, you cannot create a farm solution content type based on a sandboxed solution content type.

For more information, see Walkthrough: Create a Custom Field, Content Type, List Definition, and List Instance and Building Block: Content Type.

Empty SharePoint Project

The contents of an Empty SharePoint Project are common to all of the project templates described in this topic. An Empty SharePoint Project contains:

  • A project file

  • A project properties page

  • A References folder listing all of the assembly references required by the project.

  • A Features folder that contains a .feature configuration file, used to deploy Features to SharePoint server.

  • A Package folder that contains a package.wspdef file, used to distribute all of the file of the project.

  • A key.snk (strong-name key) file that is used to sign the assembly with a strong name.

Event Receiver

Event receivers handle events for items in the SharePoint site, such as lists, Web items, and workflows. The event receiver project template lets you handle

  • List Events

  • List Item Events

  • List Email Events

  • Web Events

  • List Workflow Events

The event receiver template creates an Empty SharePoint Project plus an Event Receiver folder. The Event Receiver folder has a single class file that contains event handlers for all of the events you specified when you created the project in the SharePoint Customization Wizard. The event receiver class can handle events that occur on the SharePoint site when items such as files, fields, items, lists, attachments, Web sites, and workflows are added, updated, deleted, or removed. For more information, see How to: Create an Event Receiver and Building Block: Event Handling.

Import Reusable Workflow

Import Reusable Workflow projects let you import a reusable, declarative workflow created in SharePoint Designer 2010 into Visual Studio. The workflow exported from the SharePoint site as a .wsp file. Once imported into Visual Studio, you can customize it, add code to it, and then deploy it to a SharePoint site. For more information, see Walkthrough: Import a SharePoint Designer Reusable Workflow into Visual Studio and What's New: Workflow Improvements.

Import SharePoint Solution Package

Import SharePoint Solution Package projects let you import an existing SharePoint site, exported to a .wsp file, into Visual Studio. Once imported into Visual Studio, you can customize its item and redeploy them. For more information, see Importing Items from an Existing SharePoint Site.

List Definition

One of the major building blocks of a SharePoint site are lists, which are defined by list definitions. A list definition is similar in concept to a base class or template — it defines all of the components of a list, such as its fields, forms, views, and toolbar. Individually created instances of the list definition, known as list instances, are based on them. List definitions also specify the content types that are associated with the list. Some examples of list definitions are as follows: documents in a document list, calendars, and task lists. Content types represent individual items in the list instance, such as: a task in a task list, an event in a calendar, or a document in a document library.

List definition projects are created by running the List Definition project template in the New Project dialog box. This creates a standalone project that can contain other SharePoint project items such as content types, list instances, and event receivers. In fact, the SharePoint Customization Wizard includes an option to add a list instance project item to your list definition project when you create it.

After you create a list definition project and build it, it is deployed as a feature to the SharePoint server where it is automatically activated and becomes available for use by SharePoint site users.

Visual Studio provides templates for the following SharePoint list definition project types:

List Type

Description

Announcements

Used to share news with team members.

Calendar

Used to list dates and to track upcoming team events and deadlines.

Contacts

Used to track people and their contact information, such as address and telephone number.

Custom List

An empty list to which you can add custom columns.

Document Library

Contains documents that team members can collaborate on. Has integrated source control for versioning.

Links

Used to manage hyperlinks.

Tasks

Activity-based items that can be used with workflows.

For more information, see Walkthrough: Create a Custom Field, Content Type, List Definition, and List Instance and Building Block: Lists and Document Libraries.

Module

Modules (not to be confused with Visual Basic modules) contain any files that you want to accompany the SharePoint project, such as development notes or a Readme file. Some SharePoint projects also use modules to include files they require. The module project template creates an Empty SharePoint Project that contains a Module node. The Module node contains two project item templates: an XML definition file, which acts as a manifest for the module, and a sample.txt file, a file included for example purposes. For more information, see Using Modules to Include Files in the Solution and Modules.

Sequential Workflow

A sequential workflow is a series of business logic steps, performed in sequence, until the last step is completed. Sequential workflows are used to manage processes that involve SharePoint items such as lists and documents. You can create either site-level (global) workflows or list-level (local) workflows, and you can select whether a workflow starts automatically or manually. For more information, see Creating SharePoint Workflow Solutions and What's New: Workflow Improvements.

For information on SharePoint 2007 workflow projects, see the section SharePoint 2007 Projects in this topic.

SharePoint 2007 Projects

SharePoint 2007 projects (sequential and state machine workflows) work the same in Visual Studio 2010 as they did in Visual Studio 2008. SharePoint 2007 projects can now run on Windows SharePoint Services 3.0 in addition to Microsoft Office SharePoint Server 2007.

SharePoint 2007 projects can run in Visual Studio 2010 only if Windows SharePoint Services 3.0 or Microsoft Office SharePoint Server 2007 is installed on the system. They cannot run with SharePoint Foundation 2010 or SharePoint Server 2010.

NoteNote

Windows SharePoint Services 3.0 or Microsoft Office SharePoint Server 2007 cannot be installed on the same system as SharePoint Foundation 2010 or SharePoint Server 2010.

To upgrade SharePoint 2007 projects into Visual Studio 2010, import the projects into Visual Studio 2010 by using the Import SharePoint Solution Package project. For more information, see Importing Items from an Existing SharePoint Site.

For more information about SharePoint 2007 projects, see SharePoint 2007 Workflow Solutions or SharePoint Workflow Solutions.

Site Definition

Site definition projects contain everything that an Empty SharePoint Project contains, plus a site definition folder with the following files:

  • A default .aspx page, used as the default Web page for the site.

  • An onet.xml file, which defines the components of the site.

  • A webtemp xml file, which specifies the site definition configurations that appear in the Template Selection section of the New SharePoint Site page.

After you create a site definition project, you add code and files to introduce functionality. For more information, see Creating Site Definitions for SharePoint.

State Machine Workflow

A state machine workflow is a set of business logic states, transitions, and actions. The steps in a state machine workflow are not performed in sequence; instead, they are triggered by actions and states. Like a sequential workflow, state machine workflows are associated with SharePoint items such as lists and documents. Once again, you can create site-level (global) workflows or list-level (local) workflows. You can also select whether a workflow starts automatically or manually. For more information, see Creating SharePoint Workflow Solutions and What's New: Workflow Improvements.

For information on SharePoint 2007 workflow projects, see the section SharePoint 2007 Projects in this topic.

Visual Web Part

A visual Web part is a Web part that you create by using the Visual Web Developer designer in Visual Studio. A Visual Web Part project is an Empty SharePoint Project that contains a Visual Web Part item. For more information, see Creating Web Parts for SharePoint and Creating Web Parts and Web Pages.

Following is a list of SharePoint project item templates. To add a project item, select the project in Solution Explorer, and then click Add New Item on the Project menu.

NoteNote

Project item templates that are the same as their SharePoint project counterparts are omitted from this list.

Application Page

An Application Page item enables you to design an ASP.NET Web page for a SharePoint site. For more information, see How to: Create an Application Page and Application _layouts Page Type.

Business Data Connectivity Model

A Business Data Connectivity Model item enables you to integrate business data into SharePoint. Business data can come from back-end server applications, such as SQL Server, Siebel, and Service Advertising Protocol (SAP). For more information, see How to: Create a BDC Model and What's New: Business Connectivity Services.

Business Data Connectivity Resource Item

A Business Data Connectivity Resource Item enables you to add a resource file to a Business Data Connectivity (BDC) solution. You can use a resource file to provide localized names for objects defined in a BDC model. You can also define properties and apply permissions to objects defined in the model. For more information, see How to: Use a Resource File to Specify Localized Names, Properties, and Permissions and What's New: Business Connectivity Services.

Empty Element

Empty elements are most often used to define SharePoint project items that lack a project or project item template in Visual Studio, such as fields. When you add an empty element to your project, a node named EmptyElement{x} is created (where {x} is a unique number). EmptyElement{x} contains a single file that is named Elements.xml. Use XML statements to define the desired elements in Elements.xml.

Global Resources File

Resource Files are XML-based files that contain all of the text strings used in the SharePoint application. This makes them easier to translate into different languages. For more information, see Localizing SharePoint Solutions.

List Definition From Content Type

Allows you to add a new list definition to a SharePoint project that is based on a content type already within that project or on the SharePoint server.

List Instance

List instances are single instances of a reusable base list definition, such as a calendar or a task list. When you add a list instance project item to your project, a node named ListInstance{x} is created (where {x} is a unique number). ListInstance{x} contains a single file that is named Elements.xml that defines the properties of the list instance. For more information, see Walkthrough: Create a Custom Field, Content Type, List Definition, and List Instance and Building Block: Lists and Document Libraries.

User Control

A User control item enables you to create custom, reusable controls that can be consumed by application pages and Web Parts that run in SharePoint. Design a user control by using the Visual Web Developer designer in Visual Studio. For more information, see How to: Create a User Control for a SharePoint Application Page or Web Part and Building Block: Web Parts.

Visual Web Part

A Visual Web Part item includes a Web Part item and a User Control item. You can design the appearance of the Web part by dragging controls from the Visual Studio Toolbox to the surface of the user control. How to: Create a SharePoint Web Part by Using a Designer and Building Block: Web Parts.

Web Part

A Web Part item provides files that enable you to design a Web part for a SharePoint site. For more information, see How to: Create a SharePoint Web Part and Building Block: Web Parts.

Workflow Association Form

A Workflow Association Form is an optional form that you can display to SharePoint site administrators when a workflow is first associated with a particular list or document library. If a site administrator is responsible for activating sequential workflows or state machine workflows, they can use this form to set activation values.

When you add a workflow association form to your SharePoint project, two files are created: an ASPX designer file, and a WorkflowAssociationForm{x}.aspx (where {x} is a unique number). A new code file named WorkflowAssociationForm{x}.cs for Visual C# projects, or .vb for Visual Basic projects, is also created under the designer file. For more information, see Walkthrough: Creating a Workflow with Association and Initiation Forms and Workflow Association and Initialization Forms.

Workflow Initiation Form

A Workflow Initiation Form is another optional form, similar to the workflow association form. SharePoint site users use this form to enter values when they activate the workflow on a document or list item. When you add a workflow initiation form project item to your project, three files are created: an ASPX designer file, a WorkflowInitiationForm{x}.aspx file, and a new code file that is named WorkflowInitiationForm{x}.cs or .vb. For more information, see Walkthrough: Creating a Workflow with Association and Initiation Forms and Workflow Association and Initialization Forms.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft