ExcludeOtherColumns (SPMetal)

Last modified: July 15, 2011

Applies to: SharePoint Foundation 2013 | SharePoint Server 2013

Specifies that SPMetal should generate code only for columns that are explicitly represented by Column elements.

Web (SPMetal)
  ContentType (SPMetal)
    ExcludeOtherColumns (SPMetal)
<ExcludeOtherColumns />

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

Attributes

None.

Child elements

None.

Parent elements

Element

Description

ContentType (SPMetal)

Specifies that a content type should be included in code generation and modifies which columns in the content type are included in code generation.

A ContentType element cannot have both an ExcludeOtherColumns element and an IncludeHiddenColumns element.

The following shows the ExcludeOtherColumns element in use. The presence of the element ensures that code generated for the Contact content type class has properties for only the three columns explicitly represented by Column elements.

<?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"/>
    <ExcludeOtherColumns />
  </ContentType>
  <ExcludeContentType Name="Order"/>
  <List Name="Team Members" Type="TeamMember">
    <ContentType Name="Item" Class=:TeamMember" />
  </List>
</Web>

Show: