Our Thinking

SharePoint Content Types

Posted by Yogendra Saxena on Aug 6, 2013 11:00:29 AM

As per MSDN documentation, a content type is a reusable collection of metadata, workflow, behaviour, and other settings for a category of items or documents in a Microsoft SharePoint Foundation 2010 list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way.

A content type is a reusable collection of settings that can be applied on specific content to organize it better. It encapsulates data requirements and enables standardization of the content throughout the system.

In a very simplistic way, a content type is a set of field definitions that represent definition of content. It is different from a SharePoint list definition as SharePoint list is specific to a location, whereas content types are not. A content type is a schema that could be used to define a SharePoint list or library. It can be modified later and the changes can be propagated to all lists and libraries using it. It is a very powerful feature of SharePoint for organizing business content. A workflow can be associated with a content type. A content type can be extended to achieve a specific implementation. It is very similar to the inheritance concept in object oriented programming. We can have one parent content type that defines base content (base class) that can be extended to a specific implementation by adding additional attributes/behaviours (extended class).

Once a content type is defined and being utilized in different parts of SharePoint, when business requirements change, you can modify the content type accordingly and push down the changes to any document library or list where the content type is being used. For example, you have an “Invoice” content type and it is being used in many SharePoint lists and libraries. Later, due to an organizational change, if you need to add a new column (e.g., “GST”), then adding this column in content type can make it available to all lists and libraries very quickly and in a controlled way.

In this post, I will illustrate how to create a simple content type and associate it with a SharePoint list.

(Because of the screenshots that follow, this post is best viewed on a desktop rather than on a mobile device.)

Let us assume we want to create a new content type that describes an invoice. Later, we will create a SharePoint list and associate the content type with it.

The invoice content type has the following attributes:

  1. Company Name
  2. Street Address
  3. City
  4. ZIP Code
  5. Phone
  6. Fax
  7. Invoice Number
  8. Date
  9. PO Number
  10. Quantity
  11. Unit Price
  12. Total

Implementation Approach:

  1. Define and create a list content type named “Invoice Content Type” based upon information specified above using SharePoint.
  2. Create a SharePoint list named “OBS Invoices.”
    • Allow management of content type.
    • Associate “Invoice Content Type” with the list.
    • Make sure that default “Item” content type is no longer allowed in the list. This step is required to make sure that we control the type of data that can be added to the list.

Instructions:

(click on screenshots to enlarge)

1. Creating content type:

  • Under Site Settings, click on “Site Content Types.”

Creating Content Type 1

  • Provide Name and Description.

Creating Content Type 2

  • Any future changes to this content type can be propagated to underlying objects. If you click on “Advance settings” on the content type, you will find a configurable setting to govern propagation.

Creating Content Type 3

Creating Content Type 4

  • Add columns in Site Content Type by clicking on either “Add from existing site columns” or “Add from new site columns.” Once defined, the site content type should look like the following:

Creating Content Type 5

2. Create a SharePoint list and name it “OBS Invoices.” Click on “List Settings” and then click on “Advance settings.”

Create SharePoint List 1

Create SharePoint List 2

3. Choose “Yes” on “Allow Management of content types?” and then save the changes.

Allow Management of content types

4. Now you should see a new option “Add from existing site content types” available in List Information; click on this option.

Add from existing site content types

5. Select the newly created “Invoice Content Type” site content type from “Available site content type from:” drop down and click OK.

Select site content type

6. You should see “Invoice Content Type” associated with the list as shown below. Click on “Change new button order and default content type.”

Invoice Content Type

7. Override the default Content Type Order as below and then click on “OK.” This change will restrict end users to add any data that is not an “Invoice.”

Override default Content Type Order

8. Now, newly created content type is associated with the list and is ready to use. Click on the “New Item” button. You will see the columns are automatically created and displayed as defined in the content type.

Newly created content type 1

Newly created content type 2

I have presented to you a very simple illustration on how to create a site content type and associate it with a SharePoint list. You can take this a step forward, by associating a workflow with the content type. When this content type is associated with SharePoint lists, it will automatically kick off a business process if a predefined criteria is met such as: “if a new invoice is created, send it to manager for an approval” or “when an invoice is 15 days old, move it to a document center’s specific document library for record keeping” etc.

Content type is a very powerful feature. It helps organize the contents, propagate the changes, and make them searchable, and workflows can be associated with it.

 

Topics: Microsoft, SharePoint

Our Thinking - The Online Blog is a source for insights, resources, best practices, and other useful content from our multi-disciplinary team of Onliners.

Subscribe to Blog Updates

Recent Posts