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

添加内容

下面的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. 【转载】2015 Objective-C 三大新特性 | 干货

    Overview 自 WWDC 2015 推出和开源 Swift 2.0 后,大家对 Swift 的热情又一次高涨起来,在羡慕创业公司的朋友们大谈 Swift 新特性的同时,也有很多像我一样工作上依然 ...

  2. Ubuntu启动eclipse问题

    Ubuntu启动eclipse问题 在Ubuntu安装eclipse后 可以在终端顺利启动eclipse:进入eclipse目录,在终端输入命令 ./eclipse > /dev/null 2& ...

  3. React Native之样式

    样式 React Native 不实现 CSS,而是依赖于 JavaScript 来为你的应用程序设置样式.这是一个有争议的决定,你可以阅读那些幻灯片,了解背后的基本原理. 声明样式 在 React ...

  4. Python学习笔记 - 数据类型和变量

    Python中有整数和浮点数,表示方法和C语言一样 浮点数也很像,不过Python可以用单引号把字符串括起来 字符串是以单引号'或双引号"括起来的任意文本,比如'abc',"xyz ...

  5. Miner.java 爬虫启动类

    Miner.java 爬虫启动类 package com.iteye.injavawetrust.miner; import java.util.concurrent.ThreadPoolExecut ...

  6. Oracle Inventory Management Application Program Interface ( APIs)

    In this Document   Goal   Solution   References APPLIES TO: Oracle Inventory Management - Version 12 ...

  7. VectorDrawable与AnimatedVectorDrawable

    VectorDrawable  Android L开始提供了新的API VectorDrawable 可以使用SVG类型的资源,也就是矢量图.先来一个例子吧. <?xml version=&qu ...

  8. Windows CE Notification API的使用方法

    1 引言      以Windows CE 为操作系统的掌上电脑(如PocketPC或HPC),除具备PC的功能外,还具备很强的自身控制能力.Windows CE API超越微软其他操作系统的 API ...

  9. Demonstration of DB Query Analyzer 6.03 Installation and Running on Microsoft Windows 8

    Demonstration of DB Query Analyzer 6.03 Installation and Running on Microsoft Windows 8 Ma Genfeng ( ...

  10. ReentrantReadWriteLock读写锁的使用2

    本文可作为传智播客<张孝祥-Java多线程与并发库高级应用>的学习笔记. 这一节我们做一个缓存系统. 在读本节前 请先阅读 ReentrantReadWriteLock读写锁的使用1 第一 ...