Defining Custom SharePoint Project Item Types

Define a new SharePoint project item type when you want to create a new kind of SharePoint project item. For example, Visual Studio 2010 does not include SharePoint project items for adding fields or custom actions to a SharePoint site. You can define your own types of SharePoint project items for creating fields, custom actions, or other types of SharePoint components.

To define a custom project item type, build a Visual Studio extension assembly that implements the ISharePointProjectItemTypeProvider interface. For more information, see How to: Define a SharePoint Project Item Type.

When you define a custom project item type, you can also add the following functionality to the project item:

To enable other developers to use your project item in Visual Studio, create an .spdata file and create an item template or project template that is associated with the project item. For more information, see Creating Item Templates and Project Templates for SharePoint Project Items.

When you define a SharePoint project item type, Visual Studio loads your extension when a project item of the associated type is added to a SharePoint project. For example, if you define a new Custom Action project item type, Visual Studio loads your extension when a user adds a Custom Action project item to a project. Visual Studio uses the same instance of your extension for all instances of the associated project item type. In the previous example, if the user adds a second Custom Action project item to the project, the same instance of your extension is used to customize the second project item.

To access a specific instance of your project item type, handle one of the ISharePointProjectItemEvents events of the projectItemTypeDefinition parameter in your implementation of the ISharePointProjectItemTypeProvider.InitializeType method. For example, to determine when a project item of your custom type is added to a project, handle the ProjectItemAdded event. For more information, see How to: Define a SharePoint Project Item Type.

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

Community Additions

ADD
Show:
© 2014 Microsoft