• Sharepoint 2013 通过Feature隐藏(Site Action)菜单


    不善言语,直接贴代码(也可通过js或css去隐藏),以下是各个菜单选项

    zz2_ID_PersonalInformation 我的设置
    zz3_ID_LoginAsDifferentUser 以其它用户登录  (这个是自己加上去的,为了方便测试)
    zz4_ID_Logout   注销         
    zz5_ID_PersonalizePage  对本页面进行个性化设置
    zz8_MenuItem_ShareThisSite 共享
    zz9_MenuItem_Create  添加应用程序  
    zz10_MenuItem_ViewAllSiteContents 网站内容
    zz11_MenuItem_Settings 网站设置
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaCreatePage 添加页
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaDesignEditor 设计管理器
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaEditPage
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaShowMenu 显示功能区
    ctl00_SiteActionsMenuMain_ctl00_ctl00 入门

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <CustomAction
       Location="ScriptLink"
      ScriptBlock="                       
                function loadjQueryScripts(src) {          
                          
                          var head = document.getElementsByTagName('head')[0];          
                          var script = document.createElement('script');          
                          script.type = 'text/javascript';           
                          script.src = src;           
                          head.appendChild(script);  
                }                   
               function hideSiteActions() {
                var menuItems = document.getElementsByTagName('ie:menuitem');
                    for (var key in menuItems)
                    {
                    
                       if(key.endsWith('PersonalInformation'))
                          {
                              menuItems[key].parentNode.removeChild(menuItems[key]);
                          }                     
                    }
                    
    
              }
              _spBodyOnLoadFunctionNames.push('hideSiteActions');
    "
       Sequence="10001">
      </CustomAction>
    </Elements>

    比如我们需要隐藏网站内容: key.endsWith('ViewAllSiteContents') 即可。

  • 相关阅读:
    NLog简单例子
    SQLite
    npm常用命令详解
    Nodejs全局安装和本地安装的区别
    C# 资源释放
    C#版本与Framework的关系
    .NET HTTP通用请求方法get/post
    log4net使用详解
    C# MongoDB--时区问题(差了8小时)
    MongoDB和Redis区别
  • 原文地址:https://www.cnblogs.com/gaoxingstyle/p/3523690.html
Copyright © 2020-2023  润新知