Click here to Skip to main content
15,881,938 members
Articles / Operating Systems / Windows 2008

MOSS for Developers - Part 9: Content Types

Rate me:
Please Sign up or sign in to vote.
2.00/5 (1 vote)
19 Aug 2009Ms-PL6 min read 17.4K   9   1
Provides an overview of content types from the perspective of a developer. This content is part 9 of the MOSS content from www.myrampup.com.

Introduction

Content types, a core concept used throughout the functionality and services offered in Windows SharePoint Services 3.0, are designed to help users organize their SharePoint content in a more meaningful way. A content type is a reusable collection of settings you want to apply to a certain category of content. Content types enable you to manage the metadata and behaviors of a document or item type in a centralized, reusable way.

For example, consider the following two types of documents: software specifications and legal contracts. It is reasonable that you might want to store documents of those two types in the same document library. However, the metadata you would want to gather and store about each of these document types would be very different. In addition, you would most likely want to assign very different workflows to the two types of documents.

You will need to install the Windows SharePoint Services 3.0 SDK.

Content Types Encapsulate Data Requirements

Content types enable you to store multiple different types of content in the same document library or list. In the preceding example, you could define two content types, named Specification and Contract. Each content type would include different columns for gathering and storing item metadata, as well as different workflows assigned to them. Yet items of both content types could be stored in the same document library.

You can think of a content type as a refinement and extension of a Windows SharePoint Services 2.0 list, which by default defines a single data structure, or schema, to which all items on that list has to adhere. In Windows SharePoint Services 2.0, the schema of an item is inextricably bound to its location. When you define a list or document library, you also define the columns for that list or library, in effect defining the data schema for all items stored in that location. Each column represents an additional piece of data you are tracking for all items on the list.

Content types are a means of encapsulating a data schema and making it independent of a SharePoint list location. In Windows SharePoint Services 3.0, you can make multiple schemas, in the form of multiple content types, available on the same list or document library. The Specification content type might have the following metadata columns: Project Lead, Developer, and Test Lead. The Contract content type, on the other hand, might have these columns: Lawyer and Signer. Yet specifications and contracts can live side-by-side in the same list or document library.

Content Type Settings

You can further extend content type functionality by using them to assign additional settings, such as workflows, or even custom attributes, to your items.

A content type can include the following information:

  • The metadata, or properties, you want to assign to this type. These are represented by columns added to the list or document library when you add the content type.
  • Custom New, Edit, and Display forms to use with this content type.
  • Workflows available for items of this content type. These can be defined to start automatically based on a selected event or condition, or through user selection.
  • For document content types, the document template on which to base documents of this type.
  • Any information necessary for custom solutions associated with this content type. You can store this information in the content type as one or more XML documents.

Content Types Enable Content Standardization

Because content types can be defined independently of any specific list or document library, you can make a given content type available for the lists on multiple SharePoint sites. This enables you to centrally define and manage the types of content you store in your site collection. For example, you could use your Specification content type to ensure that all software specifications track the same metadata, even if those specifications are stored across multiple sites.

Content Types are File Format Independent

Content types are independent of file formats. For document libraries, you can specify a document template; when the user requests a new document of this content type, Windows SharePoint Services creates a new document based on the template. However, users can still upload a document based on a different template, or even of a completely different file type.

For example, suppose you create a content type to represent a business plan. This content type could be applied to any file format. You might have the following:

  • Microsoft Office Word documents containing background information
  • Microsoft Office Excel documents containing a financial plan
  • Microsoft Office PowerPoint presentations for the venture capital pitch
  • Windows Media files of demos
  • SharePoint list items containing the specified metadata

All of these files could be assigned the Business Plan content type.

You can also assign content types to SharePoint items that do not have a file at all, such as list items or folders. Content types created for documents can be applied only to document libraries; likewise, content types created for list items can be applied only to lists. Content types created for folders can be applied to either document libraries or lists.

Site and List Content Types

You create a content type at the site level. This site content type acts as a template that is independent of any specific list or library. That site content type is then available on any child site. For example, if you create a site content type at the root site of a site collection, that site content type becomes available on any site in that site collection so that you can add it to any list in the site collection.

Content Type Inheritance

When you create a site content type, it becomes available on any child site. At this point, the site content type is available to be added to lists within the site, but has not actually been added to any specific site list.

Note: To create or manage a site content type on a site, you must have Web Designer access rights to that site. Specifically, you must have the Manage Lists and Add and Customize Pages access rights on the site where the site content type resides. To add a content type to a list, you must have List Administrator rights to that list.

When you add a site content type to a list, Windows SharePoint Services 3.0 copies a local copy of the site content type onto the list itself. This local instance is called a list content type and applies only to the list onto which it was copied.

Because Windows SharePoint Services stores a copy of the site content type as a list content type on each list to which that site content type is added, you can make changes to a list content type without affecting the site content type itself. The changes to a list content type are limited to that list and do not affect the site content type, or any other content types that inherit from that same site content type.

The following figure shows this relationship. Two site content types, Memo and Spec, are defined for a site. When the Spec content type is added to the list of a child site list, Windows SharePoint Services copies an instance of the site content type locally onto the list.

The Memo site content type is also available to be added to lists on the child site. However, this content type has not been to the list, so no copy of it resides on the list.

Image 1

Additional Resources and References

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Microsoft
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 2 Pin
vukota2146-Jan-10 21:35
vukota2146-Jan-10 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.