Content Types: Part 2 - Creation and Association of Workflows and Document Templates (Republish)

*Had to Republish this as I had some issues this week and accidently deleted it* 

So last time we went over the basics of what a Content Type is. In the most basic context, a Content Type is a grouping of Meta Data. This time around we are going to look at the basics of creating a Content Type, associating a document template with it as well as associating a workflow with it. We will then also look at enabling content types within your libraries.

Creating a content type is actually pretty simple. In this article we are focusing on operations that can be done from within the browser. Later articles will cover the creation of content types within Visual Studio.

The simplest way to create a content type is to do via the site settings page. For this you need to be the site admin. Depending on weather you have WSSv3 (Windows SharePoint Services Version 3) or MOSS (Microsoft Office SharePoint Server) installed your menus will be slightly different. To start, from your site click the site actions menu. From site actions you will have either an option that says Site Settings(On a Site Collection or Top Level Site) or an option that says modify all site settings (On a subsite). Choose Modify All Site Settings. If your menu says simply Site Settings, hover over that and choose Modify All Site Settings from the fly out menu.

Figure 1. Site Actions Menu
Site Actions

Once you choose site settings you have many options on the Site Settings page. You want to look under the “Galleries” section and find “Site Content Types”.

Figure 2. Site Settings
Site Settings Page

Once in the Site Content Types section you can browse the existing content types for the site very easily. Note that most of the common SharePoint document types (Page, Form, MasterPage, Picture, etc...) are listed as content types. SharePoint takes advantage of its own features. By making most objects into content types, a common set of Meta Data can be associated with the different object types, as well as document templates and workflows. This allows for great flexibility. It also gives you a good understanding of how content types can be used within SharePoint.

Figure 3. Content Type Gallery
Content Type Gallery

Before we create our own Content Type we should probably have an idea of what we want to create. For this example I am going to create a content type to represent a Server Build Document. This will be used when someone wants to submit a new server build request. This works well as a Content Type because I can specify common Meta Data that needs to be included with all server build requests. I can then come up with a word document as the template to be used for server builds and associate it with this content type. I can then use this word doc to allow for users to detail the specifics of their server build. I can even create a workflow that will kick off an email to the IT manager when someone submits a new server build.

Now that I know what kind of Content Type I want to create we can start. The option we want is at the top of the Page. Hit the “Create” button. This will give you a page with a few basic options for your content type. The first of which is name. Name your content type something logical so that it is easy for users to understand what it is for when they see it in SharePoint. You can also provide a description to make sure there are no questions as to the nature of your content type. The next piece allows you to choose the Parent Content type for your Content Type. This allows you to choose from existing content types so that if there is one that already closely matches what you want, you can use it as a starting point. First you choose the group that the parent type you want is in. Then you choose the parent Content Type. For this example I am going to use the Documents Content type as my Server Build Documents is going to be a document. This will make it so that I start out with all the default options (metadata, etc…) that the Document Content Type would have. I can then add my own information to make it fit my needs. The last piece is to choose what group in the Content Types Gallery you want your Content Type to appear in. I have chosen to create a new group called Server Builds. Here is what I have so far:

Figure 4. Content Type Basic Settings

After you finish entering your data simply hit OK. When you create a new Content Type the next thing you get is a page that has even more option for your Content Type. So now that we have created it, we can configure its settings. There are many options here but for now we will stick to some of the basics. Note that on the new screen you have info about your content type as well as options concerning Workflow settings, Document Information Panel Settings, etc..

Figure 5. Content Type Configuration

Once you hit have added the columns you want and you accept your changes. You end up back on the page that shows the Content Type settings. Notice that now the columns list shows the columns that you added in the last step. If you want, you can click on the names of any of the columns that you just added and change their settings so that they are hidden, or required. The default is that they are optional. Since I want these fields filled in whenever someone creates a new server build document, I have gone in and made mine all required.

Figure 7. Content Type Configuration Revisited.
Content Type Configuration Revisited

Now for the next piece. I have the required fields that I want already added. So now I want to associate a document template with this Content Type. For this example I am going to assume that we have a word doc that we normally use for server build info. Associating this document with the Content Type is easy. When associating the document template you usually want to have any common items pre-written in the document. That way when the person creates a new Server Build Document (In my case), they already have the sections of the word doc in place that they need to fill out. You can always just do a blank document but I tend to put in at least a bit of a form for them to fill out if one does not already exist. For the server build doc I have sections that explain what info they need to provide. I have named my document Server Build Request. Again logical naming is the rule of the day. Now since I have a document template already, I can associate it with my Content Type by choosing the “Advanced Settings” link on the Content Type information page.

Figure 8. Content Type Advanced Settings

Once on the Advanced Settings page. You have an option to either upload the file from the file system or you can provide a URL to the document. This works well especially if you have a library that has your document templates in it. Choose the method that makes sense for you, then you can also choose whether the content type is read only (nobody can make changes to it) and if you want your updates to be pushed down to any content types that inherit from this one. Accept you changes and TA-DA! You have now associated the document template with your Content Type.

Simple! Now that I have associated a Document template with this Content Type, whenever someone wants to make a new server build document, it will open in Word (You can use any document type you want, I just used word for this example).

So at this point I have created a content type and associated a Document Template. Only two more pieces left, associating a workflow with it, and enabling the content type in my document library.

For the workflow we will simply return to the settings page for our Content Type. Notice that under the link for advanced settings is a link for workflow settings! Once you click the link you have multiple options. You can choose one of the out of the box workflows or create your own. For this example I will simply choose one of the out of the box workflows. The Approval workflow will suit my needs for now. I simply want to kick off an email to a manager when a new Server Build is created. I choose the Approval Workflow, and then choose when I want the workflow to be kicked off, I want it whenever a new item is created or it can also be kicked off manually.

I hit ok and then I can make some more adjustments, in this case I want the email to go to a specific person. I then hit ok and now I have a workflow associated with my Content Type.

Figure 9. Workflow Settings

Figure 10. Workflow Settings Continued
Workflow Settings Continued

Once I hit OK and now I am ready to rock. I have created my Content Type, associated a workflow and a document template to it, not I just need to enable it in my document library. This is actually a very simple task. Since this Content Type was created for on my site it is already in the Content Types gallery for the site. I just need to go into any of the document libraries on my site I want to associate it with and enable Content Type management I that library.

For this go back to the site and open the document library you want to associate the Content Type with. You can click on the document library in the left hand navigation area (quick nav) or go into Site Settings and click the “Manage Content and Structure” Link then choose the Document Library you want. Once you are on the page for your Document Library, hit the “Settings” dropdown and choose “Document Library Settings.”

Figure 11. Document Library Settings

Once on the Library Settings Page choose the “Advanced Settings” link in the General Settings section. On the Advanced Settings page look at the very first option. Content Types, hit the radio button for Yes, Allow management of Content Types. Then hit OK.

Figure 12. Advanced Settings

Figure 13. Manage Content Types
Manage Content Types

Now when we return to our Library Settings page you should notice you have a new section on Content Types. Hit the link for “Add from existing Content Types”. Choose your content type off the list and add it. Once you are back to the library settings page go back up to your site and open the document library again. Now click the “New” Dropdown menu and notice you now have an option to create an instance of your Content Type.

Figure 14. New Content Type
New Content Type

That’s it. You have now created a Content Type, Associated a Document Template with it, associated a Workflow with it, and then enabled it on your document library. This should get you started. Other things to consider, you can use content types in other lists than just libraries. If I want a list of specific fields, instead of creating a list and doing the fields/columns separately, I can use a content type that is just a grouping of fields, I do not need a document template or workflow. I just adjust the list view so that it shows the columns that are in my Content Type. You then associate your content type with the list the same as we did with the library and you are good to go!

Part Three will cover Creating a custom Document Information Panel for your content type to assist in filling in the Meta Data when using Office as well as taking a look at Content Type Inheritance. Till then, have fun.