SharePoint has been around for many years now, and, as such, the core building blocks have become more important with each version. Originally, the idea behind SharePoint was to give users the ability to share and collaborate on documents, and then be able to find the documents easily when needed. Since then, SharePoint has gained many new capabilities--indeed, it is now truly a "platform"--which makes it more important than ever to structure and set up SharePoint correctly.
One of the core building blocks within SharePoint is "content type." Here's how Microsoft explains what a content type is:
“A content type is a reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents in a SharePoint list or document library. Content types enable you to manage the settings for a category of information in a centralized, reusable way”.
Whether it's a document, an item or a page, content types not only should be used; they need to be used. A content type defines the attributes of any item that can be stored within SharePoint. Within each content type you can specify the following:
· Information management policies
· Document templates
· Custom features
You can also associate a content type directly to a list or library. When you do this, you are specifying that the list or library can contain items of that content type and that the New command in that list or library will let users create new items of that type.
SharePoint Document libraries and lists can contain multiple content types. For example, a library can contain both the documents and the graphics related to a project.
When a list or library contains multiple content types, the following apply:
· The New command in that list or library lets you select from all available content types.
· The columns associated with all available content types are displayed.
You can define custom content types in the site content type gallery. Content types are derived, directly or indirectly, from a core content type, such as Document or Item. To make a content type most widely available throughout a site collection, it needs to be defined in the content type gallery of the top-level site.
So, the most relevant question now is: How do you define a content type?
Well, let's imagine we have a folder of documents that we need to get into SharePoint. Let’s also note that we don’t have any content types and would like to use them.
You can download some sample files from this site: http://www.sean.co.uk/books/microsoft-office-2010-2007-older-wiser/demonstration-example-files.shtm
Now that we have some documents, we have to define the content type from them. Let’s start with the Letter document and walk through the process.
Our first task is to open the file and see what the file contains. If we open the Letter file we see the following:
Looking at this file, we see the following interesting information:
1. Addressed to
Lots of information about files and content can be gleaned from simply opening the content. If we now look at the properties of the document, we see the following:
1. File name
2. Type of file
3. Location, including the logical path used for storing
5. Created date
6. Modified date
Now that we have all this information about this file, we can start to worm out what would be common across all files and what would be unique to this content. If we repeat the same process we used for Letter, we will see that the following fields are common.
Luckily for us, these map almost identically to the out-of-the-box content types for documents that SharePoint uses, as well as for standard document library fields. We now know that these fields don’t need to be added to SharePoint.
Default Document Library Fields
Default Document Content Type Fields
If we now look at the rest of the fields, we notice that they are unique to the types of content being used. So let’s create a base content type to start. I am going to create a document content type that contains the basic fields listed above, some of which are system ones, and then use this one as our parent.
Once it is created, we should then end up with these fields associated to the content type.
If we wanted to, we could now upload the documents we have and tag them using this content type. Though this would work for storage, it would not help in finding or using the content later, as each document is different.
So, we will now look at creating a new content type that inherits from this base one but has extra fields to accommodate for our Letter content type.
To begin we need to decide the fields that we want or need for this content. Based on our research, we need to add the following:
Type (Set to Letter)
First we need to create the site columns, which are the smaller components needed to create a content type.
The first option we have is to define the type of column we wish to create. The list is extensive, and for now we will use “single line of text.”
As you can see, we named the field with no spaces. We did this so the internal field name has no spaces. If we have spaces in the name it will modify the internal name to use “_x0020_” instead of the spaces, making our field name “Addressed_x0020_To”. Keeping the names to no spaces eliminates this, allowing us to rename the display name later as we add them to lists and libraries.
Next we repeat the same process of our other site columns with a slight change for the final field, where we set the “Default Value” property to “Letter”.
Now that we have our columns, we need to add them to our content type.
Now that we have our content type created, we can add it to a document library. Open a document library, and, from the ribbon bar, select the “Library Settings”. Once loaded, this will render out the administration links for it. To allow content type additions, we need to select the “Advanced Settings” link.
Next we need to set the “Allow Management of Content Types” to be set to “YES” instead of the default “NO”.
Now we can select the content type we just created.
Once added, the content type should now be listed in the library.
Now that we have it added, with columns and content type connected, we can upload a document and set it to use this.
Within the document library choose the “Upload Document” icon.
Select the file you wish to upload; we will use the “Letter” document.
Once chosen and uploaded, you will be presented with the “Content Type” section; for our example, choose the “Demo Document” one.
When it is chosen the required and optional fields will display ready to complete. Notice how the “DemoType” field shows the default value we set previously.
I completed the fields as shown below.
When we now view the properties of the document, the properties are displayed through the SharePoint User Interface.
As you can see, creating site columns and content types, and then associating them to document libraries and ultimately files, is simple to do. However, knowing how to define the properties and column types to use can be a bit overwhelming. In the next post, we will dig deeper into Content Types and how they are the core building block to all things SharePoint.