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

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

sharepoint 2010 如何在Ribbon区添加功能按钮_第1张图片

 

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。部署到网站上,就可以了。

 

相关资料:http://www.cnblogs.com/wsdj-ITtech/archive/2012/04/02/2280987.html

一、下面是Sharepoint2010中的一些常用到的关于Ribbon中的与List或Libraries操作相关的Location值

      CommandUIDefinition Location For Lists -

DisplayForm.aspx (View Properties) -
Actions Group    – Ribbon.ListForm.Display.Actions.Controls._children

Manage Group     -  Ribbon.ListForm.Display.Manage.Controls._children

Edit Form (Edit Properties) -

Actions Group    – Ribbon.ListForm.Display.Actions.Controls._children

Commit Group     -  Ribbon.ListForm.Display.Commit.Controls._children

Clipboard Group -   Ribbon.ListForm.Display.Clipboard.Controls._children

NewForm (New Item) -

Actions Group    – Ribbon.ListForm.Display.Actions.Controls._children

Commit Group     -  Ribbon.ListForm.Display.Commit.Controls._children

Clipboard Group -   Ribbon.ListForm.Display.Clipboard.Controls._children

Items Tab (AllItems.aspx)  -
New Group – Ribbon.Items.New.Controls._children

Manage Group – Ribbon.Items.Manage.Controls._children

Actions –  Ribbon.Items.Actions.Controls._children

Workflows –  Ribbon.Items.Workflows.Controls._children

List Tab (AllItems.aspx) -
View Format –  Ribbon.List.ViewFormat.Controls._children

Datasheet  –    Ribbon.List.Datasheet.Controls._children

Manage Views – Ribbon.List.ManageViews.Controls._children

Share Track – Ribbon.List.ShareTrack.Controls._children

Customize List –  Ribbon.List.CustomizeList.Controls._children

Settings – Ribbon.List.Settings.Controls._children

http://msdn.microsoft.com/en-us/library/gg552606(v=office.14).aspx

广州京微信息科技有限公司,.微软sharepoint解决方案提供商。

你可能感兴趣的:(收藏,SharePoint,custom,ribbon,customAction)