SharePoint is a powerful platform, but is SharePoint really anything without custom coding and is an out of the box solution worth the trouble? The short answer is if you want a web based file share out of the box is fine…but if you need anything else, then plan on coding and jumping through a few hoops.
So what do you get out of the box?
Basic (very basic) versioning control
Change the background and the color
So when does coding being? It begins when you want to change the “SharePoint” word or logo at the top left of the screen. When it comes to SharePoint the thought of it as a CMS needs to go away and it needs to be thought of as a platform for development.
SharePoint demonstrates its extensibility and need for custom development when it comes to utilizing functionality that is promised in the out of the box functionality but is not delivered. One area that this is very apparent is with version control and retention policies. Version control works well out of the box but it does not do anything with retention policies meaning that if you need to maintain the current version’s retention policy independent from the historical version’s retention policy custom code will be needed.
To accomplish this functionality there are five requirements.
A document library to hold the current documents.
A content type that can be used for the record with applicable metadata.
A record center with a record library to capture the versions.
The record center must be setup as a Send To location for the SharePoint farm.
Some code with an event receiver to capture the versions.
Using this methodology when a user begins the process to update a document the current version is immediately sent to the event receiver and based on the logic within there is a determination whether or not to archive. The document is then sent to Send To location (the record center) which will handle the routing to the correct record library. The record library can have whatever retention policies required by the documents applied.
Functionally there is only a few lines of code that are required for this to function:
- public override void ItemUpdating(SPItemEventProperties properties)
- SPFile file = properties.ListItem.File;
- string strOut = "";
- OfficialFileResult retVal = file.SendToOfficialFile(out strOut);
- string value = retVal.ToString();
However there is a bit more code that is required to make this a fully functioning option. Click Here to see the full code (not including the installer for the feature).