Here is the way how to create a Content type through feature.
1) Create a feature (I hope you know how to create a feature or go to this MSDN link.)
2) In element.xml add following xml tag
Name="Name of Content Type"
Description="Description of Content Type"
Group="Your Own Group"
<DocumentTemplate TargetName="your template.doc" />
<Module Name="Name of Content Type"
Url="_cts/Name of Content Type">
<File Url="your template.doc" />
3) Explanation of this tag,
ID = new generated content type ID [0x010100<NEW GUID without hyphen>]
FeatureId = feature id used in feature.xml
Group = your group name if group exist then it will create a new group in content type.
DocumentTemplate = name of your document/excel template
4) Module will relate your template to content type.
Name = name of your content type. Same as content type name.
SetupPath = relative path for physical template as we are putting our template in feature folder.
Path= no need to give as we are using SetupPath.
Url = all the content type template wil be saved in _cts folder. You can see this folder in sharepoint designer only. After “_cts/<Name of content type>” shold be same as Module name and ContentType name.
File Url = this will be name of document.
Only need to install the feature and activate the feature.
You can refer How to add document library with folders and content types through feature/site definition.
Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to firstname.lastname@example.org with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!
If anyone would like to have their advertisement posted on this blog, please send us the requirement details to email@example.com