Share via


Activatefeature : opération Stsadm (Office SharePoint Server)

Mise à jour : 2007-04-26

Operation name: Activatefeature

Activates a feature in the feature collection. You must first determine the scope of the feature. If the scope is Web-based or is a site collection scope, the url parameter is required. However, if the scope is farm-based, the url parameter is not required.

NoteRemarque :

If you try to use the url parameter on a farm-scoped feature, you will receive the following error message: “The feature ‘<feature name>’ applies to the entire farm; the URL parameter cannot be used with farm-scoped features."

Syntax

stsadm -o activatefeature

**   {-filename <relative path to Feature.xml> | -name <feature folder> | -id <feature ID>}**

[-url] <URL name>

[-force]

Parameters

Parameter

Value

Required?

Description

filename

A valid file path, such as "MyFeature\Feature.xml"

Yes

Path to feature must be a relative path to the 12\Template\Features directory. Can be any standard character that the Windows system supports for a file name.

Notes

If the feature file is not found on disk, the following error message is displayed: “Failed to find the XML file at location '12\Template\Features&lt;file path>'.”

name

Name of the feature directory, such as “MyFeature”

Yes

Name of the feature folder located in the 12\Template\Features directory

id

A valid GUID, such as “21d186e1-7036-4092-a825-0eb6709e9280”

Yes

GUID that identifies the feature to activate

Notes

If the ID is specified but the feature does not exist, the following error message is returned: "Feature '<id>' is not installed in this farm, and cannot be added to this scope."

url

A valid URL, such as http://*server_name*

Yes

URL of the Web application, site collection, or Web site to which the feature is being activated

force

<none>

No

Activates a feature. This causes any custom code associated with the feature to rerun.