Compartir a través de


ProjectItem Element

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

<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 Providing 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 Providing 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 ISharePointProjectItemTypeProvider.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 ISharePointProjectItemTypeProvider.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 Extending 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.

You must include either a Files or a ProjectItemFolder element, but not both.

ProjectItemFolder

Optional ProjectItemFolderType element.

Represents a mapped folder.

You must 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

Namespace

https://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel

Schema name

SharePoint Project Item Schema

Validation file

ProjectItemModelSchema.xsd

Can be empty

No

See Also

Concepts

SharePoint Project Item Schema Reference