首页 > 其他专区 > SharePoint >

sharepoint 如何在Ribbon区添加功能按钮

SharePoint 2023-01-12

继续前面的一篇内容,sharepoint  如何在列表中添加功能菜单操作项,这次主要是记录下,在Ribbon区域添加功能按钮,例如添加收藏按钮,如下图所示:

sharepoint 如何在Ribbon区添加功能按钮
 

1。还是一样,添加一个空元素,CollectionRibbonItem

修改XML文件代码,在<elements></elements>标签中,添加CustomAction,

 

  <CustomAction

    Id="Ribbon.Library.Actions.AddAButton"

    Location="CommandUI.Ribbon"

    RegistrationId="101"

    RegistrationType="List"

    Title="Add a Ribbon Button">

    <CommandUIExtension>

      <CommandUIDefinitions>

        <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" />

        </CommandUIDefinition>

      </CommandUIDefinitions>

      <CommandUIHandlers>

        <CommandUIHandler

          Command="NewRibbonButtonCommand"

          EnabledScript="javascript:SetEnableRibbonSubscribe();"

          CommandAction="javascript:alert('Hello, world');" />

      </CommandUIHandlers>

    </CommandUIExtension>

  </CustomAction>

 

2。部署到网站上,就可以了。


Copyright © 2016-2023 office学习教程网 office.tqzw.net.cn. All Rights Reserved.