在开发文档库过程中,需要加入自己的自定义菜单,有人是通过JavaScript来加入的,但有一定局限性,下面演示如何通过Feature往文档库中加入自定义菜单。
未加入之前的效果图如下:
加入自己的feature代码如下
<?xml version="1.0" encoding="utf-8" ?><Feature xmlns="http://schemas.microsoft.com/sharepoint/" Id="9197E6E3-F617-4702-9C81-4C89FEA52490" Title="Customer Add Menu" Description="add a customer menu" Scope="Site" Hidden="FALSE"> <ElementManifests> <ElementManifest Location="elements.xml"/> </ElementManifests></Feature>
elements代码如下:
<?xml version="1.0" encoding="utf-8" ?><Elements xmlns="http://schemas.microsoft.com/sharepoint/"><Module Name="Sport" Path="" Url=""> <File Url="Sports.aspx" Type="Ghostable" IgnoreIfAlreadyExists="FALSE" /></Module> <CustomAction Id="CustomerMenus" GroupId="N/A" Location="EditControlBlock" RegistrationType="ContentType" RegistrationId="0x0120" Sequence="1000" Title="Customer Menus" > <UrlAction Url="~Site/Sports.aspx"/> </CustomAction></Elements>通过如下的代码 注册feature:
"C:/Program Files/Common Files/Microsoft Shared/Web Server Extensions/12/bin/stsadm" -o installfeature -filename CustomerMenu/Feature.xml -force
把CustomerMenu文件夹考到C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/Features下
运行上面的 注册代码
在网站操作-网站设置-网站集功能中就可以看到自己的Features