Prash's Blog

Defining Custom Folder content type and custom document content type July 14, 2009

Filed under: SharePoint — prazjain @ 10:49 pm
Tags: ,

A  Two Part Article Series

Part 1 : It would be about creating fields and custom content type for document and one

for folder. Then creating a feature to bind them together and activate on a site collection.

Part 2 : This would explain about you can associate those content types programmatically

with a document library.

Here we begin with Part 1

Note : Whereever you see Guids, replace them with new ones on your machine.

First we create a few fields that we can use in our custom content type

Create a file myfields.xml and paste this content in it :

<Elements xmlns="">

<!-- first two fields are for creating custom document content type -->
<Field Type="Text" DisplayName="File Checksum" Required="FALSE" MaxLength="255" 

Group="MyGroup" ID="{01837735-8dec-4f20-b725-5d05e8747f60}" SourceID="{89369214-f359-419c

-80de-14763a3fd415}" StaticName="FileChecksum" Name="FileChecksum"  ShowInNewForm="FALSE" 

ShowInEditForm="FALSE"  ShowInFileDlg="FALSE"></Field>
<Field Type="Note" DisplayName="Information" Required="FALSE" NumLines="6" RichText="TRUE" 

RichTextMode="Compatible" AppendOnly="TRUE" Sortable="FALSE" Group="MyGroup" 

ID="{f48d6644-70ff-402c-847f-728f388d19b7}" SourceID="{89369214-f359-419c-80de-

14763a3fd415}" StaticName="Information" Name="Information"></Field>
 <!-- folder status field used by Custom Folder -->
 <Field Type="Choice" DisplayName="Status" Required="TRUE" Format="Dropdown" 

FillInChoice="FALSE" Group="MyGroup" ID="{61CA18AF-307D-4e08-9907-0274ECABEE56}" 

SourceID="{89369214-f359-419c-80de-14763a3fd415}" StaticName="CustomFolderStatus" 

 <Default>Not Started</Default>
 <CHOICE>Not Started</CHOICE>
 <CHOICE>In Progress</CHOICE>

Now we create another file ctypesCustomDocument.xml and paste this content in it :

<Elements xmlns="">

 <ContentType ID="0x010100F2895C5AACCB5A4599ACEF15F4E082D3" Name="My Custom Doc Type" 

Group="MyGroup" Version="1">
 <FieldRef ID="{f48d6644-70ff-402c-847f-728f388d19b7}" Name="Information" 

 <FieldRef ID="{01837735-8dec-4f20-b725-5d05e8747f60}" Name="File Checksum" 


Then create a file ctypesCustomFolderType.xml and paste this content in it :

<Elements xmlns="">

 <ContentType ID="0x01200051F2CB82D79099439C4C3AF20A5517B5" Name="My Custom Folder Type" 

Group="MyGroup" Version="0">
 <FieldRef ID="{61CA18AF-307D-4e08-9907-0274ECABEE56}" Name="Status" Required="TRUE"  




So just to re-iterate what we have done till here is :
Create a custom document type called “My Custom Doc Type” that includes two field

“Information” and “File Checksum”.
Create a custom folder content type called “My Custom Folder Type” this includes one field

“Status” which is a choice field.

Now we create a feature.xml file and put references to these three xml files in that one


Copy this xml in feature.xml file :

<Feature xmlns=""
 Title="Custom Content Types"
 Description="Installs Custom Content Types"
 <ElementManifest Location="myfields.xml"/>
 <ElementManifest Location="ctypesCustomDocument.xml"/>
 <ElementManifest Location="ctypesCustomFolderType.xml" />

Now copy all the 4 files we have created till now into 12-


Install the content types using this command (you would have to add stsadm to your path

variable for this to work)

stsadm -o installfeature -name CustomContentTypes -force

Once it is installed, we see how it can be used in the next article of this series.


One Response to “Defining Custom Folder content type and custom document content type”

  1. […] on creating a custom document library and attaching the custom types to the list, I would have a separate post for creating those custom content […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s