Friday, July 1, 2011

Site Content Type, Site Column Concept & Common Confusion


After a long break, again I am back to write another blog post. I don’t have much work at office so you can imagine where I am investing time & energy. Yes, of course lots of coffee & debate with colleagues. Today’s most interesting argument was on confusion between site columns, content type’s relationship & dependency. Below are the few glimpses of baffled questions.
  • What happen if we delete Site Columns or Content Types which are already using throughout the site?
  • What happen if we update/ modify existing Site Columns or Content Types?
  • Will we really be able to delete existing referenced Content Types or site Columns?
  • What exact difference between Content Types and Site Columns?

Well enough confusion to address. Please allow me to have another big cup of coffee to finish this article before my coffee.

Back now! Content Types is a coolest feature of MOSS 2007. 

It is introduced to manage, organize content in a meaningful & steady way across site collection. It’s a reusable collection of metadata or other settings can be applicable to certain type of content.

Content Types only holds the reference of Site Columns or fields but does not contain columns or fields itself. As a result, columns can only be referenced in a Content Types so columns need to be created separately.
The reference between Content Types and site Columns maintained using SPFieldLink (Microsoft.SharePoint.SPFieldLink).


Site Columns are basically working as a template. It means whenever you attach any Site Columns to SharePoint list, a local copy of that site columns (i.e. as list column) will be created. But interestingly SharePoint maintains the same field GUID for the above mentioned local copy or list column as well as for Site Column.


So now you can understand how the SharePoint apply any changes in Site Column to its local copy. Yes, SharePoint uses that field GUID to track which list columns/local copy of site columns are "children" of a given site column and based on that the changes propagates.

Same way if you add a content type to a list, the site columns included in that content type are copied locally onto the list as list columns.

If you update site columns using feature or object model, you can specify whether you desire to propagate those changes to the list columns based on the site column or not.
Now come to last point to discuss if you want to delete site column or content types then how it will behave? If you want to delete any site column which is included in content types or list, you need to first remove all instances of site column.

But if you remove any site column from site content type, then it will remove from site content type but the local copy/orphan column will not be deleted. Keep in mind that removing the site column from site content type is not the same as deleting it in the lists that use it already.

Enough funda, huh!! But still you need it please visit the links in Ref. Site Section.

Ref. Site: