继续前面的一篇内容,sharepoint 怎么在列表中添加功能菜单操作项,这次主要是记录下,在Ribbon区域添加功能按钮,例如添加收藏按钮,如下图所示:
1。还是一样,添加一个空元素,CollectionRibbonItem
修改XML文件代码,在标签中,添加CustomAction,
<CustomAction
Id=\"Ribbon.Library.Actions.AddAButton\"
Location=\"CommandUI.Ribbon\"
RegistrationId=\"101\"
RegistrationType=\"List\"
Title=\"Add a Ribbon Button\">
<CommandUIDefinition
Location=\"Ribbon.Library.Share.Controls._children\">
<ButtonId=\"Ribbon.Library.Share.NewRibbonButton\"
Command=\"NewRibbonButtonCommand\"
Image16by16=\"/_layouts/15/2052/images/formatmap16x16.png\"
Image32by32=\"/_layouts/15/2052/images/formatmap32x32.png\"
LabelText=\"收藏\"
TemplateAlias=\"o2\" />
<CommandUIHandler
Command=\"NewRibbonButtonCommand\"
EnabledScript=\"javascript:SetEnableRibbonSubscribe();\"
CommandAction=\"javascript:alert(\'Hello, world\');\" />
2。部署到网站上,就可以了。