Share via


ExcludeColumn (SPMetal)

Applies to: SharePoint Foundation 2010

Specifies that a column is not included in SPMetal code generation.

Web (SPMetal)
  ContentType (SPMetal)
    ExcludeColumn (SPMetal)

<ExcludeColumn Name="HomeTelephone" />

Complex

Attributes and Elements

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

Attributes

Attribute

Description

Name

The name of a column in the content type that is excluded from code generation.

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.

Remarks

A ContentType element cannot have both a Column element and an ExcludeColumn element that name the same column. An ExcludeColumn element that names a hidden column may not be present in the same ContentType element that has an IncludeHiddenColumns element.

Example

The following shows the ExcludeColumn element in use.

<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal" xmlns="https://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>

See Also

Concepts

SPMetal Default Code Generation Rules

Overriding SPMetal Defaults by Using a Parameters XML File