Creating a content type
This recipe shows you how to create a content type. Content types are a powerful way to model real world objects in SharePoint.
Getting ready
This recipe works for:
SharePoint 2010 Foundation
SharePoint 2010 Standard Edition
SharePoint 2010 Enterprise Edition
SharePoint 2010 Online (Office 365 Edition)
You require either the Design or Full Control permission level to create a content type.
You will need one or more site columns to add to your content type as you create it. If you need instructions on how to create a site column, then please refer to Creating a site column recipe.
How to do it...
In the top-level site of your site collection, open the Site Actions menu and select the Site Settings option.
From the Site Settings page, select Site content types link from the Galleries heading.
The Site Content Types page is displayed. To create a new content type, click on the Create link.
Give the content type a Name, Description, and Parent Content Type (to inherit from). You can add the content type to an existing group or create a new group for this content type as you wish.
Click on the OK button to create the content type.
Your new content type will be created and displayed in the list of available content types.
How it works...
SharePoint lists and libraries have a fairly major shortcoming: every item must have the same columns applied. Imagine a real-world scenario, such as the account department of your organization. They might want to store many different types of documents, such as invoices, purchase orders, bills received, credit notes, and so on. The different documents need different columns (or metadata) associated with them. For an invoice, customer amount and due date might be important. A purchase order might record a purchase order number, supplier name, expected delivery date, and payment terms. How can we store all these different types of documents in the same document library? Content types are the answer.
Content types allow us to define the document template and metadata columns for a particular type of document. In our accounts department scenario, we would create a content type for "invoice" and another content type (with different columns and template) for "purchase order". Once we have created the content types, we could add them to our accounts department document library. Now rather than creating a new document, SharePoint will provide us with the ability to create a new invoice or new purchase order in the library. The recipe Using content types to store different types of documents in the same document library in Chapter 4 describes how to do this.
Content types are built up in a hierarchy. The content types you create must extend either a built-in type (such as document) or a custom type that you have previously created.
Content types can be defined centrally and shared throughout all the SharePoint sites within the organization. They can have "business rules" information management policies and workflows attached. Wherever the content type is used, a consistent template, metadata, and rules can be applied.
Content types can be used to bring order to the "information chaos" that most organizations experience. Defining and sharing content types for real-world business objects is the key to unlocking all the power of SharePoint. Use them!