Features的使用范围可以使场、Web应用程序、网站集、网站。
打开“网站操作”→“网站设置” →“修改所有网站设置”,在网站设置的页面中,单击“网站集功能”命令,能够看到有很多系统内置的功能
ActivateOnDefault="True"|"FALSE"
AlwaysForceInstall="TRUE"|"FALSE"
AutoActivateInCentralAdmin="TRUE"|"FALSE"
Creator="Text"
DefaultResourceFile="Text"
Description="Text"
Hidden="TRUE"|"FALSE"
ID="Text"
ImageUrl="Text"
ImageUrlAltText="Text"
ReceiverAssembly="Text"
RequireResources="TRUE"|"FALSE"
Scope="Text"
SolutionId="Text"
Title="Text"
Version="Text">
</Feature>
Feature
ActivationDependencies
ActivationDependency
ElementManifests
ElementFile
ElementManifest
Properties
Property
<ElementManifest Location=“Text”></ElementManifest>
Location属性:指定一个包含Feature元素定义的文件相对路径,如
<ElementManifest Location=“elements.xml”/>
1.feature.xml文件
<Feature Id="AA929AFF-4602-4d7f-A501-B80AC9A4BB52"
Title="这是我利用feature增加的site级别的菜单"
Description="这是我利用feature增加的site级别的菜单"
Scope="Site"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="mypage"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="200"
Title="我的日常工作"
Description="Getting up and going with inline code">
<UrlAction Url="~/site/pages/request.aspx"/>
</CustomAction>
</Elements>
3.Features的部署
使用命令行工具stsadm,编写一个批处理文件,执行即可。
echo Copying the feature...
echo.
rd /s /q "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\custaction"
mkdir "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\custaction"
copy /Y feature.xml "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\custaction\"
copy /Y elements.xml "%CommonProgramFiles%\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\custaction\"
echo.
echo Activating the feature...
echo.
pushd %programfiles%\common files\microsoft shared\web server extensions\12\bin
stsadm -o deactivatefeature -filename custaction\feature.xml -url http://mei:9000/
stsadm -o uninstallfeature -filename custaction\feature.xml -force
stsadm -o installfeature -filename custaction\feature.xml -force
stsadm -o activatefeature -filename custaction\feature.xml -url http://mei:9000/
pushd