Skip to main content

Cloud

A quick look at Office 2007 Features

Office 2007 Features:

In SPS/WSS 2003 custom behavior was accomplished by editing the XML files that define site definitions and their component elements. The MOSS analog is by way of Features, which are defined as logical collections of items and methods and are considered the modular building block for Office 2007. The server is itself built using pluggable features and a partial list is illustrated in Figure 1:

Features are also used to build custom Content Types, List and Libraries, workflows and events. The main points:

  • Provide for cross site functionality and sharing
  • Allow for pluggable behavior
  • Allow for multiple events for lists and libraries in addition to
  • Used to build site definitions, items, lists and document libraries etc
  • Deployment on Farm, Web Application, Site collection or individual web site level.
  • A hidden feature allows for features that cannot be deactivated by the site administrator and enables server wide policy and behavior.

The components of a feature are defined in an element xml file which can not only specify the field and data type but can also reference other features to build a hierarchy but can also specify custom .Net assemblies that are used with the feature. This allows events to be fired at the item level, a new and exciting addition over previous versions.

What does a feature look like?

Features live in the folder: C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES

Each feature has its own directory with the name of the feature containing Feature.xml definition file and any dependent files including subfolders. These contain the elements and methods that go to make the feature instance and can be:

· XML element definition and schema files

· ASPX pages and template files used by the feature

· DWP and .webpart files for webparts used by the feature

A typical hierarchy might look like:

Feature.xml

Activation Dependencies [Folder]

Activation Dependency files [.xml, .aspx, .docx etc]

Element Manifests [Folder]

Element.xml

Element schema

The best way to illustrate the components and creation of a feature is to actually build one. An upcoming blog titled “A custom Content Type Feature for Office 2007” describes the build and installation process for a custom Content Type. Some of the pieces used are displayed below:

In Listing 1 the Feature element has attributes and child elements as follows:

  • Title and Description: What the user sees displayed in Site and/or Site Collection features page
  • Hidden: True hides the feature from the site admin so they cannot DeActivate it
  • Scope: Site actually indicates Site Collection scope. The other options are Farm, Web Application and Site (single web site)
  • ElementManifest: The Location attribute specifies the relative path to another Xml file that contains an atomic unit of functionality for the feature.

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"

Id="D1527B59-4DE3-4385-A558-47F940DF5C61"

Title="Bloggs Feature Number One"

Description="This is just a demo feature"

Hidden="false"

Scope="Site"

Version="6.6.6.0">

<ElementManifests>

<ElementManifest Location="BloggsFeatureOne.xml"/>

</ElementManifests>

</Feature>

Listing 1: Feature.xml with attributes and a single ElementManifest

Listing 2 contains the actual pieces of functionality of the feature.

This particular feature is a Custom Content Type that is made up from a Document type with a single custom column called “Bloggs Text”. The main points:

  • ContentType ID: Contains the unique Id of the custom Content Type as created in Office 2007.
  • FieldRef ID: The unique Id of the custom columnm, “Bloggs Text” that was created and added to “Bloggs Content Type One”.

These Id values are extracted from the querystring used to access their property pages.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

<ContentType ID="0x010100796F1C80E7DBED4AA8E55838F79209C3"

Name="Bloggs Content Type One"

Group="Bloggs Custom Content Types"

Description="Test Bloggs Content Type"

Version="0">

<FieldRefs>

<FieldRef ID="{0ac0f38a-416f-4e19-97ea-c5048a2e282e}"

Name="Bloggs Text" DisplayName="Bloggs Text"/>

</FieldRefs>

</ContentType>

</Elements>

Listing 2: BloggsFeatureOne.xml showing a single FieldRef custom field

This is just a quick look and what a feature is and how it is structured. Please look at blog “A custom Content Type Feature for Office 2007” for more details.

Figure 1: Site Features settings page

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Aaron Steele

More from this Author

Follow Us