在Sharepoint 2010中添加更改项目订单功能区

时间:2011-10-03 00:59:25

标签: sharepoint ribbon

我想将更改项目订单功能区添加到功能区面板中。我已创建功能并已激活,但我仍然无法看到项目订单功能区。谁能帮我这个? 下面是我的代码

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <!--Change Item order Ribbon-->
  <CustomAction
    Id="SPChangeItemOrder"
    Location="CommandUI.Ribbon.ListItem"
    RegistrationId="101"
    RegistrationType="List"
    Title="List View Ribbon Customization"
    >
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
          <!--Get Details from CMDUI.XML-->
          <Button 
            Id="Ribbon.ListItem.Actions.ChangeItemOrder"
            Alt="Change the order of the items in this list."
            Sequence="20"
            Command="ChangeLinkOrder"
            LabelText="$Resources:core,cui_ButChangeItemOrder;"
            ToolTipTitle="$Resources:core,cui_ButChangeItemOrder;"
            ToolTipDescription="$Resources:core,cui_STT_ButChangeItemOrder;"
            TemplateAlias="o2"
            Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-192" Image16by16Left="-144"
            Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-288"
              />

        </CommandUIDefinition>
      </CommandUIDefinitions>

      <CommandUIHandlers>
        <CommandUIHandler Command="ChangeLinkOrder" CommandAction="javascript:alert('Please check Change Item Order');"></CommandUIHandler>
      </CommandUIHandlers>

    </CommandUIExtension>
  </CustomAction>

2 个答案:

答案 0 :(得分:2)

尝试类似这样的事情,其中​​RegistrationID是列表定义的Type值。如果要使用SharePoint的OOB Change Item Order命令,则不需要CommandUIHandler。

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <!--Change Item order Ribbon-->
  <CustomAction
    Id="XYZ.Webpart.Links.XYZLinksListDefinition.RibbonSortOrderButton"
    Location="CommandUI.Ribbon"
    RegistrationId="30099"
    RegistrationType="List"
    Title="List View Ribbon Customization" >
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.ListItem.Actions.Controls._children">
          <Button
            Id="Ribbon.ListItem.Actions.RibbonSortOrderButton"
            Sequence="25"
            Command="ChangeLinkOrder"
            Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="-192" Image16by16Left="-144"
            Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-192" Image32by32Left="-288"
            LabelText="$Resources:core,cui_ButChangeItemOrder;"
            ToolTipTitle="$Resources:core,cui_ButChangeItemOrder;"
            ToolTipDescription="$Resources:core,cui_STT_ButChangeItemOrder;"
            TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>

答案 1 :(得分:0)

在customaction元素中属性位置的值无效,从此处选择正确的位置值http://msdn.microsoft.com/en-us/library/bb802730.aspx