Site Column Definition Schema

 

While working on a customer project I had to create a lot of site columns, based on the columns created by a business analyst through the user interface.

As I was creating the site columns through a feature I was trying to find the Site Column Definition Schema on MSDN. And I found it. It can be found here http://msdn.microsoft.com/en-us/library/ms459922.aspx. Too bad it 's not a complete overview. That might have something to do with the disclaimer at the top of the page though:

 

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

 

Maybe there is a full reference somewhere on Technet or MSDN and I just couldn't find it, but this wasn't much help to me.

Luckily I was able to use the great post Brian LaSitis did that has a nice overview of all properties of all column types in it. 

 

[Update]

Wouter van Vught just tipped me that you shouldn't always use StaticName and SourceID. This info is  coming from this blog post by Robert Bogue.

He says:

" Version, StaticName, and SourceID aren't attributes that should typically be set. Version isn't supported at all, StaticName is only for the office clients, and SourceId is supposed to be set by the framework to the feature that created the field. SourceId is supposed to help you work back to the feature that created the fields. Well, as it turns out if you set this field to be the same as the sourceId for the fields that you added in via the UI, SharePoint doesn't mangle the document template. (So leave the sourceId in -- for this case only). "

My colleague Maarten gave me a tip to go and look at this page that contains information about the Field Element. Some of this information can be used to help determine how site columns should be described.

 

[Update2]

Found out that this post by Brian LaSitis doesn't contain all possible options. I'm adding a few extra options that I needed myself here. If you know of more options that aren't mentioned in the Brian's blog let me know by leaving a comment with the option and the field type.

 

Choice Field

 

<Field ID="{8e2b16ee-86ce-49c5-b217-91a1eee4e664}"

Name="Project"

StaticName="Project"

DisplayName="Project"

Description=""

Group="My Columns"

Type="Choice"

SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"

Format="[Dropdown/RadioButtons]"

FillInChoice="FALSE">

<CHOICES>

<CHOICE>Project A</CHOICE>

<CHOICE>Project B</CHOICE>

</CHOICES>

<Default>No</Default>

</Field>

 

DateTime Field

 

<Field ID="{b0cda4bf-3588-498b-8f5b-dcd5f860ecf0}"

Name="DueDate"

StaticName="DueDate"

DisplayName="Due Date"

Description=""

Group="My Columns"

Type="DateTime"

Format="[DateTime/DateOnly]"

SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"/>

 

Note Field

 

<Field ID="{c8da1af1-5a97-4ea9-8055-bfd9ea4e89e1}"

Name="Comments"

StaticName="Comments"

DisplayName="Comments"

Description=""

Group="My Columns"

Type="Note"

NumLines="6"

AppendOnly="TRUE"

RichText="TRUE"

RichTextMode="[Compatible/FullHtml]"

SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"/>