In SharePoint 2007, Microsoft introduced a new concept called Content type. With Content type, you can re-use settings that apply to a type of content. For example, your client requires you to create a library to store four types of expense reports. These reports are not different from what a typical medium Organization uses to track expenses. The following are the type of reports they use: employee expense, departmental weekly expense, company monthly expense, and a quarterly expense reports. On looking at each type of expense report, you realize each report is different from others; they are different because they have different number and types of columns. Of course, you can create one library for each expense report type, but that will be far less than optimal. While you were thinking of creating four libraries, the client also need to store policies and procedures for three departments; the policies and procedures also have five types with different number and types of columns. Not only is creating one library per type is not the optimal solution, but it is a recipe for an unmanageable proliferation of document libraries.
Let’s take the expense report requirement as an example. After you carefully reviewed all the expense reports provided by your client, below is a list of metadata you found associated with each report type:
Employee weekly report:
- Columns – Employee Name, Type of expense, Client Name, Account Number
Department weekly expense report:
- Columns – Department Name, Department Manager, Month
Company Quarterly expense report:
- Columns – Department Name, Quarter.
At a high level, these are expense reports, but they are four different types of expense report. If you look closely, you cannot use one document library because each type has different number and types of columns. The good news is that you can store all these, despite the differences in the number and types of columns, in a single document library. To address this requirement, you will create one document library, and then create three Content types. After you create a content type, you need to define the columns just like you define additional column when you create a document library. For each content type, you will add the columns for that type of report, i.e., a one-to-one mapping of each type of report and the content type. After creating one content type for each type of expense report, you will go into your library settings to associate the three content types you’ve created to the document library.
After attaching the three content types to your library go to your library and click on New, and you will have three options:
- New Employee weekly report
- New Department Weekly report
- New Company Quarterly report
When an employee submits an expense report, you want a workflow to route the expense report to a manager. On the other hand, the weekly expense report does not need to be routed. From an object-oriented perspective, content types are equivalent to classes, and each item created from that content type is an object.
Other than reducing the number of document libraries that you need, below some of the advantages of using content types:
- Content type allows you to store different types of documents that should be grouped based on their user or security requirements.
- Content type provides a single point of administration because changes to each type of content need to be made only in one place.
- Content types, like OOP, supports inheritance. You can define a parent content type, and then create new content types that will inherit and extend the properties of the parent.
- Content type allows you to re-use metadata, template file, workflows, and policies.
For a content type that you define at a site level, you can enable any document library within the site collections, and that content type will become available when you try to create a new item in that library. In a future article, I will show, with screenshots, an example of how to use content type to solve a common client requirement scenario.
** About the Author: Anthony Odole is a Senior Solution Architect with IBM Global Services. He is a SharePoint Subject Matter Expert. You can reach him at Odolea@gmail.com