Skip navigation

Creating and Using a New Content Type in SharePoint 2007

I want to show you how to create and use a content type in Microsoft Office SharePoint Server 2007. I'm going to use a Document Library that provides the ability to select from one of two documents, each having a unique template associated with it.

From the Site Actions menu, select Site Settings. Just above the Site columns link we used for creating our custom Column Type is a link labeled Site content types. Click that link.

Don't Change Existing Content Types

You should now be at the Site Content Type Gallery page. The same usage and warning rules apply to content types as with column types (see last week’s newsletter). Content types defined at a site level are available to that site and all subsites. It's recommended that you don't change the existing content types. At the top of this page is a Create link, which you click to begin the process of creating a new content type. You'll be prompted to enter the content type name, description, and parent content type. Let’s call this content type “Timesheet” and give it a description of “Your Company Employee timesheet.” Every content type must be based on a parent content type, the simplest being Item which contains a single text column. For our parent, choose Document Content Types/Document. Your new Timesheet content type page should look as follows.

Click the OK button to finalize the creation process. You'll be taken directly to the Site Content Type: Timesheet page, where you're given the opportunity to change various properties, such as the name and description, or add columns and so forth. For this demonstration, we're interested in the Advanced settings. Click this link to open the “Site Content Type Advanced Settings: Timesheet” page. At this point, we need to stop and create our timesheet document template.

Open Microsoft Excel and create a new template. Save the template to a location you can remember, such as My Documents. Go back to the “Site Content Type Advanced Settings: Timesheet” page and use the Browse button find and upload the new template. Leave the other settings on this page at their default values and click OK.

That’s all there is to it. You've just created a new content type named Timesheet and associated an Excel template with it. Now, perform the same steps for employee expenses. Your new content type will be called Expenses, and you'll need to create and associate a different Excel template with it.

Create a New Document Library

You should now have two new content types: Timesheets and Expenses. The next step is to create a new Document Library and associate these new content types with it. Go back to your sandbox site and create a new Document Library, giving it the name “Employee Timesheets and Expenses.” Go to the new Document Library settings and choose the Advanced settings link. At the top of the “Document Library Advanced Settings: Employee Timesheets and Expenses” page, you'll be prompted to allow the management of content types. Change this selection to Yes, and press OK. You've just told the Document Library to give you the ability to manage (i.e., add or remove) content types. As a result, your “Customize Employee Timesheets and Expenses” page has changed; it now contains a new section titled Content Types.

As you may have guessed, you can click the Add from existing content types link to add new content types to this Document Library. Click the link and add the Timesheet and Expenses content type.

You can now use your new "Employee Timesheets and Expenses” Document Library. The change you will notice is when you choose to create a new document. Go back to the Document Library “All Documents” view and click the down arrow next to the New link. Your users are now presented with the options of creating a default document, a Timesheet, or an Expenses document. If you choose either the Timesheet or Expenses option, note the template that is used.

You can customize many other settings for this new Document Library. For example, you can change the order in which the items (content types) are shown in the drop-down list. You can also change which item is the default or even remove or hide them. Go ahead and experiment with it and see the results of your efforts.

Content Type Inheritance

During the process of creating your new content types, you had to specify a parent content type. When you initially install Microsoft Office SharePoint Server, there are numerous content types created for you. In fact, every item in every list type is created from a defined content type, which is why it’s not a good idea to change the default content types.

If, for example, you go to your Portal’s top-level site and look at the Document content type, you will see that it is derived from the Item content type. If you look at the Item content type, you will see that it is derived from the hidden System content type. All content types defined at the top-level site are available to all sub-sites.

Defining a Content Type at a sub-site level will make it available to that sub-site and all children sub-sites.

I hope you now have a clearer understanding of what content types are and how to create new ones for your custom needs. Column type definitions are extremely powerful because they can promote standards, and reuse and reduce the necessary administration as your business needs change. The same goes for content types; you can create a base set of Corporate Content Types that you can use throughout your portal.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish