Sunday, May 4, 2008

Feature Basics

Features
  • Finer granularity than Site Template
  • Provide the primary deployment model for Sharepoint
  • Can deliver functionality to Farms, Web Applications, Sites and Webs
  • Defined using xml
  • Allow .NET code execution on installation, activation, deactivation and uninstallation

Features in the 12 Hive

  • Feature definitions are stored in 12\Template\Features
  • FeatureName subdirectory
  • Feature.xml defines a feature.
    • Must be named feature.xml
  • You can also have 0 or more files containing feature elements
    • By convention named elements.xml
  • You can also have 0 or more files used by the feature

Feature Schema

  • Since a feature definition is a xml file, there is a schema that defines its form.
  • Feature element
    • Required
      • ID (GUID)
      • Scope (activated at farm or web app or site or web)
    • Optional
      • Title
      • Description
      • Hidden
      • Creator
      • Etc... See WSS SDK
  • ActivationDependencies
    • Specify features to activate when feature is activated
    • Dependent features often hidden (gives a level of reuse)
  • ElementManifests
    • Element manifests (contains pointers to the manifest.xml)
    • Element files (contains declaration of elements files. e.g. if you want to put a document into a document library.)
  • Properties
    • Default values of feature properties as key value pairs

Capabilities of Features

  • Install files
  • Modify user interface elements
  • Define site elements
    • Columns
    • Content Types
    • Lists
    • Etc...
  • Create workflows
  • Almost everything you see and you don't see

Installing and Activating Features

  • Install
    • Web Solution Package (ideal)
    • You can also use Stsadm.exe
      • Copy feature to 12 hive
      • Stsadm -o InstallFeature
  • Activate feature
    • Site settings in browser
    • Or you can use Stsadm -o ActivateFeature
blog comments powered by Disqus