Wednesday, February 15, 2012

Site Provisioning Techniques

Whilst researching provisioning techniques, these are some notes I recorded.

Feature stapling

  • Extend the existing site definition.
  • DISADV: Only activated on provisioning time – so won’t affect already existing sites.
  • DISADV: Can’t provide NEW site definitions with feature stapling
  • DISADV: Feature stapling is activated before module or list element is activated in ONET.xml – can cause issues
  • DISADV: Doesn’t work if provisioning Site Templates or Web Templates

Site Templates

  • Creates a solution package (WSP)
  • ADV: Can be moved between any environment bring with it all the libraries, lists, and optionally content
  • ADV: Can provision sites using alternate xml definitions (using WebTemplate element and CustomSchema attribute for ListInstance element)
  • ADV/DISADV: Can be imported into Visual Studio and tweaked, but there are an enormous amount of files.
  • DISADV: Not supported when publishing features are enabled.

Web Templates

  • Uses the WebTemplate element in Elements.xml, together with onet.xml site definition file
  • DISADV: Cannot use feature stapling ... BUT since we can modify onet.xml directly and deploy a new version anytime, there’s no need to feature staple.
  • DISADV: Variations won’t work with Web Templates BUT workarounds do exist.
  • DISADV: No VS2010 template, but once a copy of onet.xml (from /site templates/*) is made then just add elements.xml. Not to hard.
  • ADV: Supports both FARM Sandboxed Solutions. (site collection scoped for sandboxed solution)
  • ADV: Feature based
  • ADV: Supports Cloud deployment
  • ADV: Can utilise the Publishing Feature in web templates (unlike site templates)
  • ADV: Can easily change onet.xml and redploy it to affect all new sites. (won’t affect old ones since there is no runtime reference to them)
  • ADV: Upgrades to SP2015?
  • ADV: Hierarchies can be easily created using Feature Receivers.

Site Definitions

  • Consist of WebTemp*.xml (how the definition is visible) and ONET.xml (contains the actual definitions for site provisioning)
  • Site created off site definitions store identity in: SPWeb.Template, SPWeb.Configuration, and SPWeb.TempalteId
  • ADV: Deploy via Farm Solutions, files located on the file system, but can’t do sandboxed solution (so that could be a disadvantage)
  • ADV: Site Collection features are not activated in sub sites (unlike in SP2007)
  • ADV: Can feature staple
  • ADV: Visual Studio 2010 has a site definition template.
  • ADV: Variations will only work with Site Definitions (not web templates, site templates etc)
  • ADV: Hierarchies can be easily created using XML formats.
  • DISADV: Not allowed to change the ONET.xml file after it has been used to provision a site. Never ever. Not supported.
  • DISADV: No support for Cloud solutions
  • DISADV: A lot of messy XML to deal with.
  • DISADV: Potentially upgrade issues to deal with. They won’t upgrade automatically as OOB site defs will, so extra costs involved. MS will advise not to use Site Definitions going forward. Our MOSS RAP highlighted our current site defs needed to be remediated. (A bit over kill maybe)

Provisioning Providers

  • Replace the onet.xml file with Code, and only use WebTemp*.xml.
  • Use an OOB site definition as a starting point
  • Inherit from Microsoft.SharePoint.SPWebProvisioningProvider
  • Uses SPWeb.ApplyTemaplate()
  • ADV: Supports using PortalProvisioningProvider (not foundation) which creates portal site templates (hierarchy files)
  • DISADV: Not support for Cloud solutions
  • DISADV: Indications from Microsoft are that it won’t be supported going forward and will soon be deprecated.
  • DISADV: Can cause an infinite loop when using CallBack.