Some xml elements in Features.xml file in WSS 3.0:
1. Root element: Feature. It contains following attributes:
3. ElementManifest: This element is inside ElementManifests element. There is only one attribute in this element: Location. The Location attribute points to the element definition xml file.
4. ElementFile: This element is inside ElementManifests element. There is one attribute you need to set for this element: Location. The Location attribute defines the place to put the file. The Location is relative to the root folder of this feature. For example, you have a feature called MyFeature and the Location attribute in ElementFile node is set to Pages\ViewLog.aspx. The SharePoint deployment will copy the file ViewLog.aspx in deployment package to ...\TEMPLATE\FEATURES\MyFeatuer\Pages folder.
5. Properties element: This element is inside Feature element. It is just a wrapper element. Inside it contains several Property elements
6. Property: This element is inside Properties element. There are two attributes in this element: Key and Value. It defines some key and value pairs that can be accessed in feature activation/deactivation. You can use the code snippet like this to access these properties:
While properties is the parameter passing into feature activation/deactivation event handler.
If you need to access the property value after the feature activation:
See this link in MSDN for full explanation of Features.xml.
1. Root element: Feature. It contains following attributes:
- Id: The guid to uniquely identify this feature.
- Title: The title of the feature appears in feature list
- Description: The descriptive text appears in feature list
- Version: Feature version number
- Scope: The scope this feature applies to. The possible values are: Web, Site, WebApplication and Farm
- Hidden: A boolean value to indicate if to show this feature in feature list
- xmlns: Xml namespace, always "http://schemas.microsoft.com/sharepoint/"
- ImageUrl: The image icon that appears at the left of the feature in feature list. The image should be in
\IMAGES if no path is given. - ReceiverAssembly: This is the full qualified assembly name that contains the event handler of feature installation/uninstallation, activation/deactivation.
- ReceiverClass: This is the class name in ReceiverAssembly that actually handles feature related events. This class must inherit SPFeatureReceiver
3. ElementManifest: This element is inside ElementManifests element. There is only one attribute in this element: Location. The Location attribute points to the element definition xml file.
4. ElementFile: This element is inside ElementManifests element. There is one attribute you need to set for this element: Location. The Location attribute defines the place to put the file. The Location is relative to the root folder of this feature. For example, you have a feature called MyFeature and the Location attribute in ElementFile node is set to Pages\ViewLog.aspx. The SharePoint deployment will copy the file ViewLog.aspx in deployment package to ...\TEMPLATE\FEATURES\MyFeatuer\Pages folder.
5. Properties element: This element is inside Feature element. It is just a wrapper element. Inside it contains several Property elements
6. Property: This element is inside Properties element. There are two attributes in this element: Key and Value. It defines some key and value pairs that can be accessed in feature activation/deactivation. You can use the code snippet like this to access these properties:
string strThemeValue = ((SPFeatureProperty)properties.Definition.Properties["Theme"]).Value
While properties is the parameter passing into feature activation/deactivation event handler.
If you need to access the property value after the feature activation:
SPFeatureProperty prop = site.Features[new Guid(featureId)].Properties[PropertyKey];
if (prop == null) return "";
else {
return prop.Value;
}
See this link in MSDN for full explanation of Features.xml.
Comments