Download CD Content
New to the Microsoft Office SharePoint Server 2007 architecture, Features offer flexibility in terms of developing and deploying extended functionality-such as page templates, lists, content types, Web Parts, workflow, and events-to new and existing Office SharePoint Server 2007 sites. By default, SharePoint Server 2007 includes prepackaged Features as part of its base installation, such as a My Site Feature. The Feature framework has been extended to allow developers to create custom Features.
If you worked with site definitions in SharePoint Portal Server 2003, you'll appreciate the flexibility of Features! With SharePoint Portal Server 2003, if you wanted to add a list or document library to an existing site definition, you had to work with one large ONET.XML file to modify the XML code and then track each of those changes throughout the ONET.XML file. Likewise, if you wanted to add items to the SharePoint toolbars or menus, you had to work with complex Collaborative Application Markup Language (CAML). Features overcome the complexity of injecting such changes by chunking code into smaller, more manageable files, which can be more easily tracked, versioned, and deployed.
Both developers and administrators will benefit from using Features throughout a SharePoint Server 2007 deployment. Through Feature schemas, developers can scope and add simple changes, such as provisioning new pages to a SharePoint site, or registering and deploying complex solutions developed in Microsoft Visual Studio 2005, such as event handlers or workflows. Developers can also work with the SharePoint object model, which includes Feature classes to effect changes throughout the life cycle of Features. Examples of these changes include whether certain actions or events occur when a Feature is installed, activated, deactivated, or uninstalled. In addition, administrators can install and deploy Features with ease, using command-line tools, and will have at their fingertips the ability to switch Features on or off via the activate and deactivate options on administrative user-interface pages.
SharePoint Server 2007 includes a new form of deployment, namely Solution deployment. Solutions are custom packages, or redistributable CAB files, created by developers. Solutions can include Features, site definitions, template pages, global resources, and assemblies. Administrators can deploy Features to all Web front-end servers using Solution packages, and this will be demonstrated throughout this chapter, along with other Feature deployment options.
This chapter will look at defining the Feature schemas and configuring Feature elements. It will also demonstrate creating a custom event handler using Visual Studio 2005 and including that event handler as part of a Feature. You'll also gain some understanding of the Feature object model, with a walkthrough on creating a Web Part to show activated Features in a given scope within your SharePoint deployment. Finally, you'll learn how to include and deploy Features as part of a site definition.