SharePoint Content types are a new innovation in Microsoft Windows SharePoint Services (WSS) 3.0 that let you better categorize and organize your SharePoint data. SharePoint content types let you store the same type of content in multiple locations, as well as store multiple types of content in the same location. This article shows you how to create and customize a content type and associate it with a document library.
One of the concepts at the core of Windows SharePoint Services (WSS) 3.0 is the improvement to document storage called content types. In WSS 2.0, each list (whether a document library or a regular SharePoint list) was bound to a single schema, and the schema resided within that list. With the content type innovation, a list can contain multiple schemas, and a schema can be used in multiple lists. The schema for a content type can include metadata (which would appear as columns in a SharePoint list), document templates, workflows, the document information panel, and other customizations. What this all means is that you can store the same type of content in more than one list and store more than one type of content in the same list, thus eliminating the need for multiple libraries containing information that you’d like stored in the same place. In this article, I walk you through the process of creating and customizing a content type and associating it with a document library to achieve the benefits of this useful innovation.
A Sample Library with Multiple Content Types
Let’s begin by taking a look at a document library that contains multiple content types. In the example that Web Figure 1 shows, a company’s sales team maintains a document library for various types of sales documents, including sales presentations, financial analyses, and RFP responses. The most obvious effect of content types on this library is the ability to choose different templates for the different types of documents. Thus, when you click the arrow beside New, you get a choice of the available content types.
Notice that the various content types in this library have different columns of metadata. For example, the column Deal Size contains only data for the Financial Analysis content type. Also note that all of the content types contain information in the Client column.
The template and metadata columns are two key parts of the schema for a content type. In earlier versions of SharePoint, assigning different templates and metadata columns would have required the creation of multiple document libraries. Now, let’s look at the process of creating content types.
Creating a New Content Type
When creating a content type, you first need to decide whether you want to create it on the root site level, the child site level, or the list level. Essentially, if you create the content type on one of the site levels, it will be available for all child sites and lists in that site collection; if you create it on the list level, it will be available for that list only. For example, the document library that Figure 1 shows resides at moss.litwareinc.com/SalesNew/SalesDocument; that is the Sales Document library in the new sales site, which is a child of the Litwareinc site. When creating a new content type that can be used in this document library, you can either create it at the Litwareinc (root site) level, at the New Sales (child site) level, or the Sales Documents (list) level. As a general rule, I find it best to create content types at the highest level possible because the content type will then be available to as much of the site as possible. There are, however, several reasons you might want to create a content type at an individual site or list level. For example:.
• You want to restrict use of a content type to a particular list.
• Your content type needs to incorporate columns created at the list level.
• You lack permission to create the content type at a higher level.
• When creating a child content type based on an existing content type, you might want to have the parent on the site level but the child on the list level.
I’ll show you how to create a content type at the root site level, but the steps are basically the same for creating content types at the child site or list level. To create a content type, select Site Actions, Site Settings, Modify All Site Settings. This choice will bring up various settings, including the list of galleries, which contains an option called Site content types, as Web Figure 2 shows. Click Site content types to display the available content types. Select the option to create a new content type, which opens the content type creation form that Web Figure 3 shows.
I’ve chosen to create a content type for writing letters because you might want to use such a content type throughout your organization, and using content types will let you use a company letter template, with consistent letterhead and formatting. The Parent Content Type choices affect what settings will apply to the content type. For our letter content type, we’ll base the content type on one of the basic out-of-the-box content types. Choosing the Document parent content type will result in the content type having a blank Microsoft Office Word document for its template, minimal metadata columns, and no further customizations. You can also choose to place your new content type in an existing or custom group. Placing the content type in a group makes it easier to find when you want to work with it later.
Customizing a Content Type
Now that we’ve created our content type, we want to customize its schema to maximize our benefit. The screen that Web Figure 1, at www.windowsitpro.com, InstantDoc ID 97483, shows will appear after you create the content type. You can also access this screen through the site content types gallery or by clicking the content type in Document Library Settings after you’ve associated the content type with a list. On this screen you can select or change the following settings:
• Name, description, and group. These options let you change the settings you chose when creating the content type.
• Advanced settings. These primarily let you choose a template. You can choose as a template any document to which you can browse, whether it resides on your site or locally. Note also that you don't need to select a template file (such as a .dotx file for Word).
• Workflow settings. These let you select a workflow to be associated with a content type. This option is one of the most compelling parts of using content types because it lets you have different workflows for different content types within the same document library and lets you reuse the workflow setting on additional document libraries without the need for reconfiguration. When you select Workflow settings, you’ll be able to choose from the out-of-the-box workflows or any custom Visual Studio workflows. Currently, you can’t associate SharePoint Designer workflows with a content type. Let’s hope this functionality is coming. After you associate a content type with a list, however, a SharePoint Designer workflow can be developed and attached to the list.
• Document information panel settings. These let you upload or modify the document information panel that documents created with the content type use. As you can see in Figure 4, page 62, the document information panel is an Office InfoPath form that serves as a properties pane for documents that open from SharePoint. It links metadata columns to the document, and you can drive a lot of the business logic in your Word document with the declarative rules engine of InfoPath, without having to write any code. On this form, you can upload a custom information panel (an XSN, or InfoPath form template file) and choose whether you want the information panel to always open by default.
• Information management policy settings let you define or associate custom policy settings with the content type.
• Manage document conversion for this content type settings. Choosing this option requires that document conversion be enabled for your site collection. (An administrator must enable document conversion in Central Administration.)
Continue to next page
Adding columns to the content type defines the metadata that will be available for SharePoint lists and the document information panel. Creating a column is similar to creating a content type and can be done at either the site level or the list level.
For our letter content type, we’ll add an existing column and create a few new columns. To add the existing column, simply click Add from existing site columns on the Site Content Types page. You’ll then see a list of all available columns that you can add to the content type. To create a new site column, click Add from new site column. This selection will bring up the New Site Column creation form, which Web Figure 2 shows. On this form, you can enter the Column name (e.g., Letter Date) and the type of information (e.g., Date and Time). The data type you select determines the other options that will be presented. After you’ve customized the content type, you’re ready to associate it with a document library.
Associating a Content Type with a SharePoint Document Library
Because we created the content type on the site level, we have to associate it with a list. Thinking back to the Sales Document Library we looked at earlier, the sales team has decided to start storing sales letters in the same library. This decision will help keep things organized: Sales team members can easily sort the library to group letters and other contract information without having to create multiple folders.
When you go to the document library settings, because content types have already been enabled for this document library (you’ll see how to enable content types for a document library in the Reusing a Content Type section later in this article), you’ll see a section called Content Types, which shows the content types currently available in the document library, as well as the option to add a new content type. When you choose to select a new content type, you’ll see a form that lets you select from available content types, as Web Figure 3 shows. Select the desired content type (e.g., Letter) and click Add. The new content type will now be available as a selection in the document library.
Now, when you open a new document based on the content type, it will open with the designated template and document information panel, as Figure 5 shows. Notice that the document contains the company letterhead and a basic letter format with content controls (e.g., the Client content control that Figure 5 shows). These content controls are linked to the document information panel. So, if you were to add the client’s name in the document, it would update in the document information panel. If you were to change the date in the information panel, it would update in the document. Additionally, this data will be available in the SharePoint list.
When you save the document back to the library, the custom metadata columns for this content type appear in the document library, as Figure 6 shows. (I had to adjust the default view to get the columns to appear. The columns are available to the document library as soon as you add the content type, but they must be selected in the settings page for the view.) Note that in this example, we chose to add the Letter site content type directly to this list. You also could have created a child content type based on the Letter content type, which would be useful if you want to use the same template throughout the organization but want different workflow settings for different departments.
Reusing a Content Type
Reusing a content type is as simple as associating it with another document library. For example, you could create a new site for your human resources department, with a document library called HR Documents. Because this is a new library, you must first enable management of content types for the library, which you do by opening the Document Library Advanced Settings, and selecting Allow management of content types, as Figure 7 shows.
After content types are enabled, you can add the Letter content type using the procedure described earlier. Again, you might choose to create a child content type called HR Letter at the list level. The advantage of using child content types like this is that if the parent is updated, all the children can be updated as well. For example, if HR Letter and Sales Letter are both children of Letter, and you want to change the letterhead, you only need to update the template for the Letter content type; the template for HR Letter and Sales Letter will be inherited from the parent.
Reaping the Benefits
Content types define schema for objects stored in WSS 3.0, allowing you to both store the same type of content in more than one list and to store more than one type of content in the same list. By using content types, you save yourself from having to create multiple document libraries to store data that might be better off stored in the same place. With the ease of sorting information in SharePoint, you’re much better off with a library full of many types of documents than with a whole bunch of libraries. Additionally, content types save you from having to create settings several times if you want to use the same type of document in multiple locations.