遇到了很多次对网站功能区个性化定义的任务,包括标签按钮之类的修改,每次都要重新翻书,这次总结一下,留作备用。

添加内容

下面的XML我认为主要的内容是四部分,一个是CommandUIDefinition下的tab,一个是scaling,一个是button,一个是CommandUIHandler。

如果是完整的重新添加按钮,主要是分为以下几个主要内容:

  1. 定义location
  2. 添加tab
  3. 添加group,指定grouptemplate
  4. 添加button,指定commond
  5. 添加grouptemplate,id和在group中的引用保持一致
  6. 添加commond,和button中指定的保持一致。

注意在:

Section Alignment="Top" Type="OneRow"

Type="OneRow" 即一个按钮

Type="TwoRow" 即布局两个按钮

并且尽量使所有的id都不重复。

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="listApproval"
Location="CommandUI.Ribbon.DisplayForm"
RegistrationId="100"
RegistrationType="List"
Rights="EditListItems">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Tabs._children" >
<Tab
Id="Ribbon.ApprovalRibbon"
Title="审批流程"
Description="审批流程"
Sequence="1001">
<Scaling //缩放比例
Id="Ribbon.ApprovalRibbon.Scaling">
<MaxSize
Id="Ribbon.ApprovalRibbon.MaxSize"
GroupId="Ribbon.ApprovalRibbon.ApprovalGroup"
Size="OneLargeTwoMedium"/>
<Scale
Id="Ribbon.ApprovalRibbon.Scaling.CustomTabScaling"
GroupId="Ribbon.ApprovalRibbon.ApprovalGroup"
Size="OneLargeTwoMedium" />
</Scaling>
<Groups Id="Ribbon.ApprovalRibbon.Groups">
<Group
Id="Ribbon.ApprovalRibbon.ApprovalGroup"
Description="审批流程"
Title="审批流程"
Sequence="52"
Template="Ribbon.Templates.CustomTemplateExample">
<Controls Id="Ribbon.ApprovalRibbon.ApprovalGroup.Controls">
<Button
Id="Ribbon.ApprovalRibbon.ApprovalGroup.HelloWorld"
Command="ApprovalRibbon.SubmitCommand"
Sequence="15"
Description="提交"
LabelText="提交"
TemplateAlias="cust1"
Image32by32="/_layouts/images/ALLMTGS.gif"/>
<Button
Id="Ribbon.ApprovalRibbon.ApprovalGroup.Approval"
Command="ApprovalRibbon.ApprovalCommand"
Sequence="15"
Description="审批"
LabelText="审批"
TemplateAlias="cust2"
Image32by32="/_layouts/images/ALLMTGS.gif"/>
</Controls>
</Group>
</Groups>
</Tab>
</CommandUIDefinition>
<CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.CustomTemplateExample">
<Layout
Title="OneLargeTwoMedium"
LayoutTitle="OneLargeTwoMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="cust1" />
</Row>
</Section>
<Section Alignment="Top" Type="OneRow">
<Row>
<ControlRef DisplayMode="Large" TemplateAlias="cust2" />
</Row>
</Section>
</Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ApprovalRibbon.SubmitCommand"
CommandAction="javascript:MakeModelDialog('提交审批', 560, 200, '/_layouts/15/DVT.SharePoint.Portal.RLGS.Resources/ConfirmSubmitDetail.aspx?selectdata=' + GetDetailID());"/> <CommandUIHandler
Command="ApprovalRibbon.ApprovalCommand"
CommandAction="javascript:approval();"/>
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>

修改现有按钮

修改现有按钮,只需要重写Location的定义就可以了,下面的代码修改了列表的工作流按钮

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="ReplaceWorkFlow"
Location="CommandUI.Ribbon.ListView"
RegistrationId="100"
RegistrationType="List"
Rights="EditListItems">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.ListItem.Workflow.ViewWorkflows" >
<Button
Id="Ribbon.ListItem.Workflow.ViewWorkflows"
Sequence="10"
Command="ReplaceWorkFlowCommand"
Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-48" Image16by16Left="-208"
Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-416"
LabelText="$Resources:core,cui_ButWorkflows;"
ToolTipTitle="$Resources:core,cui_ButWorkflows;"
ToolTipDescription="$Resources:core,cui_STT_ButItemManageWorkflow;"
TemplateAlias="o1"
/>
</CommandUIDefinition> </CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="ReplaceWorkFlowCommand"
CommandAction="javascript:alert('请点击左上角的审批“流程-提交” 进行发布数据');"/>
</CommandUIHandlers> </CommandUIExtension>
</CustomAction>
</Elements>

修改现有按钮时比较重要的一点就是,找到location,以下是参考的内容:

SharePoint2013 功能区的配置的更多相关文章

  1. VS2012上添加SharePoint2013模板,SharePoint2013 Tool安装配置

    今天需要在SharePoint2013上做开发,但是安装的VS2012默认只有sharepoint2010的模板,因此需要安装配置好,这里我们通过Web平台安装程序4.0来配置的 Web 平台安装程序 ...

  2. 深入浅出SharePoint2013——Search Schema配置

    如果增加了新的Metadata,请上传文件到文档库后,并确保每个字段都填充了数据.然后执行全文爬网. 这样才会产生对应新的管理属性.

  3. ASP.NET 网站管理工具

    ylbtech-Miscellaneos:ASP.NET 网站管理工具 1. 网站管理工具概述返回顶部 网站管理工具概述 介绍 使用网站管理工具,可以通过一个简单的 Web 界面来查看和管理网站配置. ...

  4. Sitecore CMS中更改项目的模板

    如何在Sitecore CMS中创建项目后更改项目的模板. 在创建项目时选择了错误的模板,或者创建了新模板并将现有项目更新为新模板时,这非常有用.   警告! 更改模板时要小心.如果原始模板具有不在新 ...

  5. 【SpringBoot1.x】SpringBoot1.x 分布式

    SpringBoot1.x 分布式 分布式应用 Zookeeper&Dubbo ZooKeeper 是用于分布式应用程序的高性能协调服务.它在一个简单的界面中公开了常见的服务,例如命名,配置管 ...

  6. 【springcloud】Zuul 超时、重试、并发参数设置

    转自:https://blog.csdn.net/xx326664162/article/details/83625104 一. Zuul 服务网关 服务网关 = 路由转发 + 过滤器 1.路由转发: ...

  7. ADFS3.0与SharePoint2013安装配置(原创)

    现在越来越多的企业使用ADFS作为单点登录,我希望今天的内容能帮助大家了解如何配置ADFS和SharePoint 2013.安装配置SharePoint2013这块就不做具体描述了,今天主要讲一下怎么 ...

  8. SharePoint2013工作流workflow manager配置

    SharePoint2013版本的工作流较sharepoint 2010变化较大,将工作流部分从sharepoint中分离出来为单独的服务,通过与sharepoint关联使用. SharePoint2 ...

  9. Sharepoint2013商务智能学习笔记之Performancepoint service 配置(九)

    1)配置Performance Service服务 第一步,新建performance service.先在管理中心,系统设置区域点击管理服务器上的服务,确认Performance Service服务 ...

随机推荐

  1. EBS DBA指南笔记(一)

    第一章  ORACLE APPLICATIONS 的组件与架构 1.ebs组件的几大构成:客户端,form server,web server,concurrent processor,数据库.每个组 ...

  2. Cocos2D:塔防游戏制作之旅(九)

    炮塔哲学:敌人,攻击波和路径点 在创建敌人之前,让我们先为它们"铺路".敌人将沿着一系列的路径点前进,这些路径点互相连接,它们被定义为敌人在你创建的世界中移动的路径. 敌人将在第一 ...

  3. 从JDK源码角度看并发锁的优化

    在CLH锁核心思想的影响下,JDK并发包以CLH锁作为基础而设计,其中主要是考虑到CLH锁更容易实现取消与超时功能.比起原来的CLH锁已经做了很大的改造,主要从两方面进行了改造:节点的结构与节点等待机 ...

  4. Thinkpad W520 + Ubuntu 12.04LTS, 13.10, 14.04LTS安装Nvidia显卡驱动设置

    Thinkpad W520 + Ubuntu 12.04LTS, 13.10, 14.04LTS安装Nvidia显卡驱动设置 http://henzhai.com/tech/2012/07/w520- ...

  5. c++友元函数与友元类

    友元函数和友元类的需要: 类具有封装和信息隐藏的特性.只有类的成员函数才能访问类的私有成员,程序中的其他函数是无法访问私有成员的.非成员函数可以访问类中的公有成员,但是如果将数据成员都定义为公有的,这 ...

  6. DesignModeler&nbsp;GestureRecgin…

    DesignModeler : 设计模式     GestureRecginzer:手势识别 作者:韩俊强 原创版权地址:http://blog.sina.com.cn/s/blog_814ecfa9 ...

  7. React native开发中常见的错误

    react native环境搭建请移步:react native环境搭建 这里说说react native创建完成之后,运行中出现的常见问题, 问题1: java.lang.RuntimeExcept ...

  8. 手把手带你画一个漂亮蜂窝view Android自定义view

    上一篇做了一个水波纹view  不知道大家有没有动手试试呢点击打开链接 这个效果做起来好像没什么意义,如果不加监听回调 图片就能直接替代.写这篇博客的目的是锻炼一下思维能力,以更好的面多各种自定义vi ...

  9. Android Support Design 控件 FloatingActionButton

    经常刚可以看到悬浮控件,比如印象笔记的下面那个绿色的悬浮按钮,这个控件非常简单也是来自Design Support Library中同理需要在android studio中加入依赖库:design库 ...

  10. g++和gcc的相同点和区别

    gcc和g++的区别和联系 gcc和g++都是GNU(一个组织)的编译器. 1.对于.c后缀的文件,gcc把它当做是C程序:g++当做是C++程序: 2.对于.cpp后缀的文件,gcc和g++都会当做 ...