加入功能区buttonRibbon Button到SP2010特定列表或库
加入功能区button到SP2010某一列表或库
你仅仅须要新建一个SP项目。加入一个feature,加入一个空白元素。编辑它的Elements.xml文件。
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <CustomAction
Id="{41C23DD2-6FEB-4636-AE4F-41B8E2A2D415}"
<strong> RegistrationId="100"</strong>
<strong> RegistrationType="List"</strong>
Location="CommandUI.Ribbon"
Sequence="5"
Title="Custom Lists Button"> <CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.List.Settings.Controls._children">
<Button
Id="{09A51440-C3A6-4103-874A-383747042E75}"
Alt="Custom Lists Button"
Sequence="5"
Command="{42844423-382B-4e87-BEC4-34B0601DA98F}"
Image32by32="/_layouts/images/menulistsettings.gif"
Image16by16="/_layouts/images/itdcl.gif"
LabelText="Custom Lists Button"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions> <CommandUIHandlers>
<CommandUIHandler
Command="{42844423-382B-4e87-BEC4-34B0601DA98F}"
EnabledScript=""
CommandAction="javascript: alert('Custom Lists Button!');" />
</CommandUIHandlers> </CommandUIExtension>
</CustomAction>
</Elements>
部署解决方式。激活feature结果是:
这种方法的缺点是button会出如今每一个现有自己定义列表中,就算你新建自己定义列表也会出现。
原因是RegistrationId="100"。这里100是自己定义列表的类型。
假设要给某个列表实例提供button的话。你能够使用一下方法:
创建列表定义并分配RegistrationId到列表定义的Type
<CustomAction
Id="{67A1EB46-A49B-4aff-B456-068909C39599}"
RegistrationId="10000"
RegistrationType="List"
Location="CommandUI.Ribbon"
Sequence="5"
Title="List Definition Button"> <CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.List.Settings.Controls._children">
<Button
Id="{3F083F8B-95D6-436b-A130-3EF1E8C04E3C}"
Alt="List Definition Button"
Sequence="5"
Command="{AF90D558-00DA-4ccf-B4F4-169CD9162CD0}"
Image32by32="/_layouts/images/menulistsettings.gif"
Image16by16="/_layouts/images/itdcl.gif"
LabelText="List Definition Button"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions> <CommandUIHandlers>
<CommandUIHandler
Command="{AF90D558-00DA-4ccf-B4F4-169CD9162CD0}"
EnabledScript=""
CommandAction="javascript: alert('List Definition Button!');" />
</CommandUIHandlers> </CommandUIExtension>
</CustomAction>
最后,加入列表定义到feature,这样它能随着解决方式一起部署:
激活feature后,你应该能够给予新建列表定义创建新的列表:
用程序加入button
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
//Depending from the feature scope - can be SPSite
var web = properties.Feature.Parent as SPWeb; //Get list instance - here You can also create a new list
var list = web.Lists.TryGetList("RibbonButtonList"); if (list != null)
{
//Add new user custom action to the list
var userAction = list.UserCustomActions.Add();
//Set action's location
userAction.Location = "CommandUI.Ribbon";
//This one is Optional as we are adding the same later
userAction.ImageUrl = "/_layouts/images/menulistsettings.gif";
//Command body
userAction.CommandUIExtension = @"<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location=""Ribbon.List.Settings.Controls._children"">
<Button
Id=""{5557CC45-324E-41bb-9E88-A535DBF1BF6B}""
Alt=""Programmatically Added Button""
Sequence=""5""
Command=""{234F6E9E-80A3-4f70-9683-02067515801E}""
Image32by32=""/_layouts/images/menulistsettings.gif""
Image16by16=""/_layouts/images/itdcl.gif""
LabelText=""Programmatically Added Button""
TemplateAlias=""o1"" />
</CommandUIDefinition>
</CommandUIDefinitions> <CommandUIHandlers>
<CommandUIHandler
Command=""{234F6E9E-80A3-4f70-9683-02067515801E}""
EnabledScript=""""
CommandAction=""javascript: alert('Programmatically Added Button!');"" />
</CommandUIHandlers> </CommandUIExtension>"; userAction.Update();
}
}
部署解决方式时要确保我们要加入button的列表已经存在并激活feature。你应该能在列表功能区看到新button:
这就是所有了,如今你应该能够通过以上方法加入功能区button到一个列表了吧。
加入功能区buttonRibbon Button到SP2010特定列表或库的更多相关文章
- sharepoint 2013 列表和库标签 元数据导航配置(2)
接前面提到的,如何创建一个术语库.sharepoint 2013 列表和库标签 元数据导航配置(1), 现在要做的,就是如何在自定义或者文档库中使用这个术语库,实现标签功能,通过这些标签,找到对应的文 ...
- 跟我学SharePoint 2013视频培训课程——排序、过滤在列表、库中的使用(10)
课程简介 第10天,SharePoint 2013排序.过滤在列表.库中的使用. 视频 SharePoint 2013 交流群 41032413
- 跟我学SharePoint 2013视频培训课程——探索默认的列表和库(6)
课程简介 第6天,探索默认的列表和库. 视频 SharePoint 2013 交流群 41032413
- [Beginning SharePoint Designer 2010]列表和库&内部内容类型
本章概要: 1.SPS如何组织管理数据 2.如何创建列表和文档库 3.如何使用视图来过滤分类,分组列表和库 4.如何创建内容类型来应用一个定义好的结构到数据和文档中
- OSS.Common获取枚举字典列表标准库支持
上篇(.Net Standard扩展支持实例分享)介绍了OSS.Common的标准库支持扩展,也列举了可能遇到问题的解决方案.由于时间有限,同时.net standard暂时还没有提供对Descrip ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q121-Q123)
Question 121 You are designing a SharePoint 2010 workflow that will be used to monitor invoices. Th ...
- Sharepoint学习笔记—习题系列--70-576习题解析 -(Q1-Q3)
这里我把从网上搜集到的针对Sharepoint 70-576的有关练习进行系统的解析,整理成一个系列, 分期.分批次共享出来,供大家研究. 70-573考试注重的是"知道"相关知识 ...
- 自定义和扩展 SharePoint 2010 Server 功能区
了解构成 SharePoint 2010 服务器功能区的组件以及如何通过演练两个功能区自定义项方案来自定义功能区. 适用范围: Microsoft SharePoint Foundation 2010 ...
- SharePoint 2013无代码实现列表视图的时间段动态筛选
本文介绍两种为列表视图设置时间段筛选器的方法.其中,第一个方法用于SharePoint Server,第二个方法同时还能用于SharePoint Foundation. 方法一:日期筛选器Web部件 ...
随机推荐
- javascript圆形排列
显示效果如下: 需要用到的知识: 等于半径长的圆弧所对的圆心角叫做1弧度的角,用符号rad表示,读作弧度.用弧度作单位来度量角的制度叫做弧度制.另外一种度量角的方法是角度制.弧度制的精髓就在于统一了度 ...
- PLA能收敛的证明
题:如果资料D线性可分,PLA如何保证最后能得到最优解. 思路:假设$w_f$能够分割资料D,$w_{t+1}$经过更新$w_{t+1}=w_t + y_{n(t)}x_{n(t)}$后,与$w_f$ ...
- Gradient boosting
Gradient boosting gradient boosting 是一种boosting(组合弱学习器得到强学习器)算法中的一种,可以把学习算法(logistic regression,deci ...
- 普林斯顿大学算法课 Algorithm Part I Week 3 排序稳定性 Stability
稳定性(Stability):先按性质A排序,再按性质B排序,性质B相同的那些项是否仍然是按性质A排序的? 一个稳定的排序,相同值的元素应仍保持相对顺序(relative order) 稳定的算法:插 ...
- sharepoint 2013 reporting services 远程server返回错误: (500) 内部server错误。
在sharepoint 2013部署reporting services过程中,点击管理中心,server上的服务.系统配置.提示了一个错误: 远程server返回错误: (500) 内部server ...
- 动画原理——线性来回运动&&波动
书籍名称:HTML5-Animation-with-JavaScript 书籍源码:https://github.com/lamberta/html5-animation 1.在正选函数中,随角度的增 ...
- 在SQL Server 2008 中使用SQL脚本创建登录用户并授权
到处都使用超级用户sa显然是不安全的,因此有创建用户并让其只能访问某个数据库的必要.当然可以使用SQL Server自带的图形界面向导,但是太难用用了!有时候代码比较直接,比如这里: --使用已经创建 ...
- fs读取某个json文件的数据
/** * Created by Administrator on 2016/7/12. * 流数据 */ var fs = require('fs'); var stream = fs.create ...
- Swift 基本数据类型
Swift 1,Swift支持所有C和Objective-C的基本类型,支持面向过程和面向对象的编程机制. 2,Swift提供了两种功能强劲的集合类型:数组和字典. 3,元组. 4,可选类型. 5,S ...
- 关于表格动态添加行并处理相关表单元素的一些修改----优化for重用(2)
功能介绍: 1.处理了动态行与表单的设值问题 2.添加了行的向上或向下排序 3.添加了可以在当前行的下边或上边增加新行的功能 4.添加了可以单选或勾选多项删除不需要的行的功能 5.添加了新增的行的高亮 ...