Friday, March 9, 2012

Detection of field value changes in document library

There is pretty easy way to detect change of field value in document library. You can use EventReceiver attached to your content type. ItemUpdating is a good place detects changes and performs validation if required. In my case it was required to detect that value of field has changed and additionally to synchronize value of two fields and perform some additional validation of entered values.

Thursday, March 8, 2012

Document Library and custom rendering templates

Goal was to create document library with requirement to hide fields which have 'Hidden' string in name (unfortunately I could not use ShowIn.. settings due to specific requirement from external tools integrated with SharePoint instance). My first idea was to use custom FormTemplates with custom ListFieldIterator.

Quickly, it turns out that there is a problem with registering FormTemplates for content types based on document library. SharePoint 2010 was ignoring them. The only solution I was able to find, was to disable content type inheritance. That allowed me to register my own FormTemplates.