ProjectItem element

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Represents a SharePoint project item. This element the required root element of the .spdata file.

Syntax

<ProjectItem DefaultFile = "File that opens in the editor when you open the project item"
    FeatureReceiverClass = "Class that implements a feature receiver for the project item"
    FeatureReceiverAssembly = "Assembly that defines a feature receiver for the project item"
    SupportedTrustLevels = "Trust levels that the project item supports"
    SupportedDeploymentScopes = "Deployment scopes that the project item supports"
    Type="Identifier for the project item">
  <Files>...</Files>
  <ProjectItemFolder>...</ProjectItemFolder>
  <SafeControls>...</SafeControls>
  <FeatureProperties>...</FeatureProperties>
  <ExtensionData>...</ExtensionData>
</ProjectItem>

Attributes and elements

The following sections describe attributes, child elements, and parent elements.

Attributes

Attribute Description
DefaultFile Optional xs: string attribute.

The relative path, including the file name, of the file that opens in the Visual Studio editor when you open the SharePoint project item in Solution Explorer. The path is relative from the folder that contains the .spdata file.
FeatureReceiverClass Optional xs:string attribute.

The fully qualified name of a feature receiver class for this SharePoint project item. For more information about feature receivers, see Provide packaging and deployment information in project items.
FeatureReceiverAssembly Optional xs:string attribute.

Specifies the fully qualified name of an assembly that defines a feature receiver for this SharePoint project item. For more information about feature receivers, see Provide packaging and deployment information in project items. For more information about fully qualified assembly names, see Assembly Names.
SupportedTrustLevels Optional xs:string attribute.

Specifies the trust levels that this SharePoint project item supports. This value can be one of the following strings: Sandboxed, FullTrust, or All. The value All specifies both Sandboxed and FullTrust.

In a custom SharePoint project item type, the value of this attribute corresponds to the value that you assign to the SupportedTrustLevels property in your implementation of the InitializeType method. If you specify a different value for this attribute, Visual Studio overwrites the value so that it specifies the same trust level that you specify in the SupportedTrustLevels property.
SupportedDeploymentScopes Optional xs:string attribute.

Specifies the deployment scopes that this SharePoint project item supports. This value is a comma-delimited string that consists of one or more of the following strings: Farm, Site, Web, WebApplication, or Package. For example: Web, Site

In a custom SharePoint project item type, the value of this attribute corresponds to the value that you assign to the SupportedDeploymentScopes property in your implementation of the InitializeType method. If you specify a different value for this attribute, Visual Studio overwrites the value so that it specifies the same trust level that you specify in the SupportedDeploymentScopes property.
Type Required xs:string attribute.

The identifier for the SharePoint project item. In a custom SharePoint project item type, the identifier is the string that you pass to the SharePointProjectItemTypeAttribute. For more information, see How to: Define a SharePoint project item type.

For a list of the identifiers for the built-in SharePoint project items included with Visual Studio, see Extend SharePoint project items.

Child elements

Element Description
ExtensionData Optional element.

Represents a collection of custom data items that are associated with the SharePoint project item.

You can include only one ExtensionData element.
FeatureProperties Optional element.

Represents a collection of property values that are included with a Feature when it is deployed to SharePoint.

You can include only one FeatureProperties element.
Files Optional FileCollectionType element.

Specifies the files to deploy with the SharePoint project item, such as Feature element files and the output of dependent non-SharePoint projects.

Include either a Files or a ProjectItemFolder element, but not both.
ProjectItemFolder Optional ProjectItemFolderType element.

Represents a mapped folder.

Include either a Files or a ProjectItemFolder element, but not both.
SafeControls Optional element.

Represents a collection of ASPX controls and Web Parts that are designated as secure for any user to access on any ASPX page on the SharePoint site.

You can include only one SafeControls element.

Parent elements

None.

Element information

Property Value
Namespace http://schemas.microsoft.com/VisualStudio/
2010/SharePointTools/SharePointProjectItemModel
Schema name SharePoint Project Item Schema
Validation file ProjectItemModelSchema.xsd
Can be empty No

See also

SharePoint project item schema rseference