通过Feature往文档库中加入自定义菜单

本文介绍如何使用Feature在SharePoint文档库中添加自定义菜单,包括Feature和elements.xml文件的配置示例,以及如何部署这些自定义功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在开发文档库过程中,需要加入自己的自定义菜单,有人是通过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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值