Installing and Activating Feature Definitions

After you create your feature definition and define the necessary feature elements, you need to install the feature so that it is available for activation at the appropriate scope.

Installing the feature

Features are stored at Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES. To install a new feature, create a subdirectory under this feature folder and place your feature.xml file in that folder. The folder can also contain supporting element files and subdirectories. Confirm that you have configured the new directory to inherit permissions from the parent folder so that SharePoint has the appropriate rights to access your feature definition.

Once you have added your feature folder in the appropriate directory, follow these steps to use the Stsadm.exe command-line tool (MS use) to install your feature:

1.
Open a command prompt on your SharePoint server.

2.
Navigate to the <system drive>Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN directory.

3.
Enter the stsadm command with the filename parameter pointing to your feature subdirectory and XML file as follows:

stsadm -o installfeature -filename <featuresubdirectory>
  feature.xml <ENTER>

This command is shown in Figure 9.5.

Figure 9.5. Adding a feature using the stsadm command


4.
When the command line returns that the operation completed successfully, type exit <ENTER> to exit the command line.

You can also uninstall a feature by using the Stsadm.exe command-line tool. To uninstall a feature, follow these steps:

1.
Open a command prompt on your SharePoint server.

2.
Navigate to the <system drive>Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN directory.

3.
Enter the stsadm command with the filename parameter pointing to your feature subdirectory and XML file as follows:

stsadm -o uninstallfeature -filename <featuredirectory>
  feature.xml -url

4.
When the command line returns that the operation completed successfully, type exit <ENTER> to exit the command line.

Activating/deactivating features

After a feature has been installed, you can activate it in the scope you want by either using the Stsadm.exe command-line tool or by activating it in the SharePoint site settings user interface if the feature is installed as a visible feature.

To activate a feature using the Stsadm.exe command-line tool, follow these steps:

1.
Open a command prompt on your SharePoint server.

2.
Navigate to the <system drive>Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN directory.

3.
Enter the stsadm command with the filename parameter pointing to your feature subdirectory and XML file as follows:

stsadm -o activatefeature -filename <featuredirectory>
  feature.xml -url http://Server/Site/Subsite <ENTER>

This command is shown in Figure 9.6.

Figure 9.6. Activating a feature using the stsadm command


4.
When the command line returns that the operation completed successfully, type exit <ENTER> to exit the command line.

To activate a visible feature, follow these steps:

1.
Navigate to the site in which you want to add the feature.

2.
Choose Modify All Site Settings from the Site Actions Site Settings menu in the top right corner of any page in the site.

3.
Click Site features from the Site Administration section.

4.
Click Activate next to your feature definition, as shown in Figure 9.7.

Figure 9.7. Activating a feature using the SharePoint site administration user interface


To deactivate a feature using the Stsadm.exe command-line tool, follow these steps:

1.
Open a command prompt on your SharePoint server.

2.
Navigate to the <system drive>Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN directory.

3.
Enter the stsadm command with the filename parameter pointing to your feature subdirectory and XML file as follows:

stsadm -o deactivatefeature -filename <featuredirectory>
  feature.xml -url http://Server/Site/Subsite <ENTER>

4.
When the command line returns that the operation completed successfully, type exit <ENTER> to exit the command line.

To activate a visible feature, follow these steps:

1.
Navigate to the site in which you want to add the feature.

2.
Choose Modify All Site Settings from the Site Actions Site Settings menu in the top right corner of any page in the site.

3.
Click Site features from the Site Administration menu.

4.
Click Deactivate next to your feature definition.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.237.122