ExcludeOtherContentTypes (SPMetal)

Last modified: July 15, 2011

Applies to: SharePoint Foundation 2013 | SharePoint Server 2013

Specifies that classes are generated only for content types that are explicitly represented by ContentType elements.

Web (SPMetal)
  ExcludeOtherContentTypes (SPMetal)
<ExcludeOtherContentTypes />

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



Child elements


Parent elements



Web (SPMetal)

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

A Web element cannot have both an ExcludeOtherContentTypes element and an IncludeHiddenContentTypes element.

The following is an example of a ExcludeOtherContentTypes element in use. In this example, it ensures that a class is generated for only the Contact content type.

<?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"/>
  <ExcludeOtherContentTypes />
  <List Name="Team Members">
    <ContentType Name="Item" Class="TeamMember" />