Create Content Type in SharePoint 2010

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

 

Content Types in SharePoint

Content types are a core organizational feature of SharePoint 2010. They are designed to give users the ability to organize SharePoint content in a centralized and meaningful manner. Site columns (metadata) can be encapsulated within a content type to allow for reusable structure or independently added to sites and lists. At its most basic level, a content type is a collection of settings that can be applied to content. They are reusable since content types are independent of sites and lists. A content type includes site columns to define the desired information. Example: The Task content type includes site columns for Task Status, Start Date, and Due Date where the Schedule content type includes site columns for Location, Start Time, and End Time. Using these content types as a template when a new task or event list needs to be created is much more efficient than rebuilding separate lists from site columns. A content type is a flexible and reusable template of type list item or document (or inherited from some other basic types available in SharePoint) that defines the columns and behavior for an item in a list or a document in a document library. A content type can also have receivers and workflows associated with it.  You can create content types with either the Out-of-Box option available in your SharePoint Site or by using Client and Server Object models.   A content type is a reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents in a Microsoft SharePoint Server 2010 list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way. Workflow lets you attach a business process to items in SharePoint Server 2010. This article describes content types and workflows and provides guidance about how to plan to integrate them into your SharePoint Server 2010 document management solution.

To enrich your career and become a SharePoint professional, visit Tekslate, the global online training platform:" SharePoint Training". This course will help you achieve excellence in this field.

Content-type overview

A content type defines the attributes of a list item, a document, or a folder. Each content type can specify the following:

  • Properties to associate with items of its type.
  • Metadata to associate with items of its type.
  • Workflows that can be started from items of its type.
  • Information management policies to associate with items of its type.
  • Document templates (for document content types).
  • Custom features.

  A partial list of the built-in content types is shown in the following table.  

Name ID
System 0x
Item 0x01
Document 0x0101
Event 0x0102
Issue 0x0103
Announcement 0x0104
Link 0x0105
Contact 0x0106
Message 0x0107
Task 0x0108
Workflow History 0x0109
Post 0x0110
Comment 0x0111
East Asia Contact 0x0116
Folder 0x0120

  Notice that many of these base content types correspond to types of lists that you can create. This correspondence is by design. For more information, see Default List Content Types. You can determine the line of descent for a content type by carefully inspecting its content type ID. For example, notice that all of the content types descended from Item have IDs that begin with the ID for Item. The ID for a child content type is formed by appending information to the ID of the parent content type. For more information, see Content Type IDs. For a complete list of built-in content types, see the fields of the SPBuiltInContentTypeId class.   Content Type Groups The built-in content types are organized in groups such as List Content Types, Document Content Types, Folder Content Types, and _Hidden. You can obtain the name of the group that a given content type belongs to by reading the Group property of an SPContentType object in server code or the same property of a ContentType object in client code. Content types that belong to the "_Hidden" group are not displayed in the user interface for users to apply to lists or use as the basis for other content types. For more information, see Content Type Access Control. You can find out which content types are available for assignment to lists and libraries, and how they are grouped, by viewing the Site Content Types gallery under Site Settings in the user interface. You can obtain a more complete listing—one that includes hidden content types—by writing server code such as the following console application. C# using System; using System.Collections; using Microsoft.SharePoint; namespace Test { class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http://localhost")) { using (SPWeb web = site.OpenWeb()) { // Create a sortable list of content types. ArrayList list = new ArrayList(); foreach (SPContentType ct in web.AvailableContentTypes) list.Add(ct); // Sort the list on group name. list.Sort(new CTComparer()); // Print a report. Console.WriteLine("{0,-35} {1,-12} {2}", "Site Content Type", "Parent", "Content Type ID"); for (int i = 0; i < list.Count; i++) { SPContentType ct = (SPContentType)list[i]; if (i == 0 || ((SPContentType)list[i - 1]).Group != ct.Group) { Console.WriteLine("n{0}", ct.Group); Console.WriteLine("------------------------"); } Console.WriteLine("{0,-35} {1,-12} {2}", ct.Name, ct.Parent.Name, ct.Id); } } } Console.Write("nPress ENTER to continue..."); Console.ReadLine(); } } // Implements the Compare method from the IComparer interface. // Compares two content type objects by group name, then by content type Id. class CTComparer : IComparer { // The implementation of the Compare method. int IComparer.Compare(object x, object y) { SPContentType ct1 = (SPContentType)x; SPContentType ct2 = (SPContentType)y; // First compare group names. int result = string.Compare(ct1.Group, ct2.Group); if (result != 0) return result; // If the names are the same, compare IDs. return ct1.Id.CompareTo(ct2.Id); } } } When this application runs on a website that has only the built-in content types available, it generates the following output.  

SharePointGroupDomainGroup       RootOfList Document Collection  itemitemFolderFolder

 

 

 

Check Out SharePoint Tutorial

  Document Content Types

DocumentList View StyleFormPictureMaster Page Wiki Page Basic page Web Part Page Link to a Document Dublin Core Columns itemDocumentDocumentDocumentDocument Document Basic Page Document Document      0x01010x010100734778F2B7DF462491FC91844AE431CF0x0101010x0101020x010105 0x010108 0x010109 0x01010901 0x01010A 0x01010B  

  Folder Content Types

FolderDiscussionSummary Task ItemFolderFolder 0x01200x0120020x012004

    Group Work Content Types

CirculationNew WordResourceOfficial NoticePhone Call Memo Holiday   What's New Notification Timecard Resource Group Users  ItemItemItemItemItem Item Item Item Item Item 0x01000F389E14C9CE4CE486270B9D4713A5D60x010018F21907ED4E401CB4F14422ABC653040x01004C9F4486FBF54864A7B0A33D02AD19B10x01007CE30DD1206047728BAFD1C39A8501200x0100807FBAC5EB8A4653B8D24775195B5463 0x01009BE2AB5291BF4C1A986910BD278E4F18 0x0100A2CA87FF01B442AD93F37CD7DD0943EB 0x0100C30DDA8EDB2E434EA22D793D9EE42058 0x0100CA13F2F8D61541B180952DFB25E3E8E4 0x0100FBEEE6F0C500489B99CDA6BB16C398F7

  List Content Types  

ItemEvent ReservationsSchedule and Reservations Schedule Issue Announcement Link Contact Message Task Post Comment  East Asia Contact   SystemItem  EventEventEvent Item Item Item Item Item Item Item Item Item   0x010x01020x0102004F51EFDEA49C49668EF9C6744C8CF87D0x01020072BB2A38F0DB49C3A96CF4FA855299560x0102007DBDC1392EAF4EBBBF99E41D8922B264 0x0103 0x0104 0x0105 0x0106 0x0107 0x0108 0x0110 0x0111 0x0116

    Special Content Types  

Unknown Document Type  Document 0x010104

   

What metadata do Content Types save?

  Simply put, Content-Type is a set of field definitions. How are they different from standard Lists in SharePoint? Lists are specific to a location, content types are not. Content types in fact represent the blueprint or schema definition that can be applied to a List or any other type of library for that matter. Content Types can also be scoped at the site level such that they are available to an entire site hierarchy.   Create Content Type Out-of-Box Create Content Type with Visual Studio 2010 (Server Object Model) Create Content Type using Client Object Model   To create one in your SharePoint 201o site, follow the steps below:

  1. Click Site Actions ➪ Site Settings.
  2.  Under Galleries click on “Site content types” and then click Create. See the Screen below

70

  1.  Next Click on “Create” and Provide Name and Description on the “New Site Content-Type” Page. Next, from “Parent content type from” Drop-down select “List Content Types” and from “Parent content-type” select “Issue” type. In Group select “custom content types” or select a new group and give it a name.

  72

4. When the content type is created, you can see that in “Custom Content Types”. 74

  1. Click on the “Test Content-Type” and you can change various options like Title, description, etc, and also can add additional Site columns that get carried along with this content type.

75  

  1. Now either you can create a new list or navigate to an existing one with which you want to associate the custom template (content-type).
  1. After you navigate to the new list, on the ribbon click the list tab and then list Settings.
  1. Click Advanced Settings and then click Yes for the “Allow management of content types?” button and click Ok.
  1. Click OK to return to the new list’s settings page.

 

  1. On the Advanced Settings page, click the “Add from existing site content types” link to add your new content type to the custom list. In the Available Site Content Types list, find the custom content type you created, and then click the Add button to move that content type into the “Content types to add” list.

 

  1. Now you can navigate to your list and click New. Your custom Content-Type will be in the drop-down for your selection.

76   Sample Content-Type 77

For an in-depth understanding of SharePoint click on:

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox