ExcludeContentType (SPMetal)

Last modified: July 15, 2011

Applies to: SharePoint Foundation 2013 | SharePoint Server 2013

Specifies that no class is generated for a content type.

Web (SPMetal)
  ExcludeContentType (SPMetal)
<ExcludeContentType Name="Announcements" />

Complex

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

Attributes

Attribute

Description

Name

The content type that is excluded from code generation.

Child elements

None.

Parent elements

Element

Description

Web (SPMetal)

Specifies the name and access level (public or internal) of the class (derived from DataContext) that SPMetal generates.

List (SPMetal)

Includes a list in code generation and modifies how code is generated for list-scoped content types.

A Web element cannot have both a ContentType element and an ExcludeContentType element that name the same content type. An ExcludeContentType element that names a hidden content type may not be present in the same Web element that has an IncludeHiddenContentTypes element. Finally, a Web element cannot have both an ExcludeOtherContentTypes element and an IncludeHiddenContentTypes element.

The following is an example of a ExcludeContentType element in use.

<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal" xmlns="http://schemas.microsoft.com/SharePoint/2009/spmetal">
  <ContentType Name="Contact" Class="Contact">
    <Column Name="ContId" Member="ContactId" />
    <Column Name="ContactName" Member="ContactName1" />
    <Column Name="Category" Member="Cat" Type="String"/>
    <ExcludeColumn Name="HomeTelephone" />
  </ContentType>
  <ExcludeContentType Name="Order"/>
  <List Name="Team Members" Type="TeamMember">
    <ContentType Name="Item" Class=”TeamMember" />
  </List>
</Web>

Show:
© 2014 Microsoft