Sunday, May 11, 2008

MOSS2007 - Content Types

So as most of you are probably aware now, or maybe not, MOSS2007 now has a concept of what’s called Content Types. Content Types are a way of storing multiple documents in a document library each with their own metadata and behaviours. In SPS2003 and WSSv2 one of the limitations was Metadata. If you wanted different Metadata for each document you would have to create separate document libraries to handle this. Also unless you wrote quite a complex event handler or used a 3rd Party workflow solution any behaviours you needed to happen based on document types would fire for all documents as there was no way of distinguishing content. So now in MOSS007 this has been changed.

What does a Content Type comprise of?

A Content Type is basically, Metadata Columns and behaviours logically grouped under one name. In the MOSS2007 the Metadata columns are referred to as “Site Columns”.

How do you create a Content Type?

As Content Types can be used on multiple Document Libraries over many Team Sites, they need to be created at the highest level within the MOSS2007 system. The following are the steps needed to create and use a Content Type:

1. Create Site Columns

2. Create Site Content Type

3. Add Site Columns to Content Type

4. Specify any Templates to use for Content Type

5. Associate the Content Types with a Document Library

Select the “Site Settings” and then “Modify All Site Settings” from the Portal home page. Before we can actually add the “Content Type” you need to add the relevant “Site Columns” you wish to use. To do this select the “Site Columns” option from within the “Galleries” section.




The “Site Column Gallery” lists all the Site Columns that are available throughout the MOSS2007 System. They are logically grouped. To create some new columns simply press the “Create” button. Much like SPS2003 you will need to specify the type of Column it will be.


For our example it will be a choice menu. Fill in the details as below:


Once you have added the “Approved Status” column we will create a second called “Sent To Customer”.





Now that we have created two “Site Columns” they should appear in the main “Site Column” listing grouped by the heading “Demonstration Sites Columns”.


Now we have the relevant “Site Columns” Content Types can now be created. To create a Content Types simply select the “Site Content Types” option from the “Galleries” section within the “Site Settings” section of the Portal:
When creating a Content Type you need to specify what base content type this will inherit from. In our case we will chose the “Document Content Types”, and then select the “Document” as the Parent Content Type.





We will also create a new “Content Types” Group so we can logically find them later. This is a nice feature, if we had a large system we may have 100’s of different types. Without the grouping option I could take a while to find the ones we are after. So now we have a single content type. To complete the configuration we still need to complete the following:

1. Add Site Columns to Content Type

2. Specify any Templates to use for Content Type

3. Associate the Content Types with a Document Library

Add Site Columns to Content Type

From the Site Content Type screen for “Demonstration Expenses” select the “Add from Existing Site Columns” option.



Select the “Demonstration Site Columns” group and then select the relevant site column to associate with the Content Type.

The site column should now appear in the columns section of the document library Administration page.

Specify any Templates to use for Content Type

From the Settings section select the “Advanced Settings” and choose to upload a new template. In this case will choose an InfoPath form.



Now follow the steps as before to create the “Demonstration Sales Proposal” Content Type with the following settings.





Associate the Content Types with a Document Library

Create a new Document Library.



Notice when you click the “New” arrow in the document library that is gives the standard options of creating a document based on the Document Template chosen when you created the document library.

To associate the Content Types select the Site Settings option and then “Document Library Settings”.


At this moment in time our document library is not enabled for Content Types. You can see this by looking at the page and NO content type section appears.
To enable Content Types select the “Advanced Settings” option and select the “Allow Management of Content Types” checkbox and apply this.


When you return to the administration screen a new Content Types section will appear.



Select the ”Add from existing site content types”. And then select the “Demonstration Content Types Group” and select both the “Demonstration Expenses” and “Demonstration Sales Proposal” Content Types.
Upon returning to the Administration screen you will now see these listed in the Content Types section along with the default document content type. For our purposes we do not need this default one as we only want to accept our custom content types. To remove a content type association to a document library simply select the content type you wish to delete and then select the “Delete this Content Type” from the settings section.


Now we should only have our two custom content types listed.
So from a user perspective what does it look like now. To see this go into the document library and select the “New” arrow and you should be presented with a new list of templates you can work with.

When you click the “Demonstration Expenses” an InfoPath form should now launch.


Upon selecting the “Demonstration Sales Proposal” a word template should then launch.
I have filled in a copy of each of the template and saved them in the document library like so:


Upon first glance it just looks like SPS2003. Multiple documents in one document library. Also the Metadata does not seem to be there that I chose for the Content Type. In MOSS2007 if you are using Content Types you will not see the Metadata in the “All Items” Views. To access the Metadata simply select the “Edit Properties” option from the document menu.

Notice our custom Metadata appears for that document. Most importantly however in the Content Type option that can be changed. This enables your users to change Content Types if it is more relevant to another one you may have.
If we decide that this one here should be a “Demonstration Sales Proposal” we simply change this but notice what happens to the “Approved Status” field.



It now changes to match the “Site Columns” that are associated with the Content Type. In this example we only have one Site Columns but in the real world you may have many.

So to review:

What are Content Types? What are they used for?

Content Types are a way of logically assigning Metadata and Behaviours to Content Types instead of just a document library. It gives you the flexibility to have a more “free” structured taxonomy and just control the data itself by the content that it is.

Well hopefully this has been useful. I am very excited about this functionality as it now brings a lot more reasons to use MOSS2007 to the table.

No comments: