共用方式為


Element Scope

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

You can activate a Feature for a single scope, including farm, Web application (or virtual server), site collection, and Web site. The Feature scope is determined by the setting of the Scope attribute in the Feature element.

While a Web site Feature is one that you scope at the individual Web site level, a site collection Feature contains items that apply to the site collection as a whole (for example, content types that are shared across the site collection), as well as items that can be activated per site. Elements that can have either site collection or site scope include list definitions (templates and instances), modules (file sets), and item content type behaviors (per-item custom menu options and per-item events).

Note

For Web site scoped Features, a user must have the ManageWeb permission on the Web site to perform Feature activation or deactivation and property update through the object model or through the user interface (UI). For site collection scoped Features, a user must have the ManageWeb permission on the root Web site of the site collection to perform Feature activation or deactivation and property update through the object model, but to navigate to the Site Collection Features page and to activate or deactivate Features through the UI, the user must be a site collection administrator.

You can activate or deactivate a Web application Feature, and it can contain, for example, the following types of elements:

  • Administrative Web application links or other links

  • Delegate control registrations

  • Feature/site template associations

  • Document transform registrations

You scope a farm Feature for an entire server farm. A farm Feature contains a number of elements that are critical for implementing applications and logic anywhere within a deployment. A farm Feature can contain, for example, links to /_layouts pages and files, /_admin pages, and other elements.

Scope and Feature Globalization

You can implement two types of resources in Features for support files:

  • Local resources stored in a subdirectory within the Features folder in the \Template\Features directory.

  • Shared application Feature and site definition resources that are stored in \web server extensions \12\Resources and are designed to be used across Features and site definitions.