我想创建一个功能区按钮,该按钮将与各种列表一起使用。我的意思是,相同的自定义操作应针对列表,文档库,公告列表等。

还。无论列表中包含的内容类型如何,它都应该工作。

自定义动作定义应该是什么?

有帮助吗?

解决方案

只需将其连接到0x01内容类型。

我们的SharePoint Audit Suite中使用的语法示例如下:

<!-- Add a new action to the SharePoint 2010 Ribbon bar for each list to show all audit entries for a list Item  -->
<CustomAction
  Id="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Action"
  Location="CommandUI.Ribbon"
  RegistrationType="ContentType"
  RegistrationId="0x01"
  >
  <CommandUIExtension>
    <CommandUIDefinitions>
      <CommandUIDefinition
        Location="Ribbon.Documents.Share.Controls._children">
        <Button Id="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button"
                Command="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button.Command"
                Image16by16="/_layouts/images/Muhimbi.SharePointAudit/Report16.gif"
                Image32by32="/_layouts/images/Muhimbi.SharePointAudit/Report.gif"
                LabelText="$Resources:MuhimbiAuditProvisioningResources,ECB_ViewAuditLog;"
                Sequence="11"
                TemplateAlias="o1" />
      </CommandUIDefinition>
      <CommandUIDefinition
        Location="Ribbon.ListItem.Share.Controls._children">
        <Button Id="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button"
                Command="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button.Command"
                Image16by16="/_layouts/images/Muhimbi.SharePointAudit/Report16.gif"
                Image32by32="/_layouts/images/Muhimbi.SharePointAudit/Report.gif"
                LabelText="$Resources:MuhimbiAuditProvisioningResources,ECB_ViewAuditLog;"
                Sequence="11"
                TemplateAlias="o1" />
      </CommandUIDefinition>
      <CommandUIDefinition
        Location="Ribbon.Calendar.Events.Share.Controls._children">
        <Button Id="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button"
                Command="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button.Command"
                Image16by16="/_layouts/images/Muhimbi.SharePointAudit/Report16.gif"
                Image32by32="/_layouts/images/Muhimbi.SharePointAudit/Report.gif"
                LabelText="$Resources:MuhimbiAuditProvisioningResources,ECB_ViewAuditLog;"
                Sequence="11"
                TemplateAlias="o1" />
      </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
      <CommandUIHandler
        Command="Muhimbi.SharePoint.Audit.Ribbon.ListItem.Share.ViewAuditLog.Button.Command"
        CommandAction="javascript:window.location='{SiteUrl}/_layouts/Muhimbi.SharePointAudit.Site/AuditLogViewer.aspx?RequestFrom=listitem&amp;ItemId=' + SP.ListOperation.Selection.getSelectedItems()[0].id + '&amp;ListId={ListId}&amp;Source=' + escape(window.location)"
        EnabledScript="javascript:function singleEnable()
        {
          var items = SP.ListOperation.Selection.getSelectedItems();
          var ci = CountDictionary(items);
          return (ci == 1);
        }
        singleEnable();" />
    </CommandUIHandlers>
  </CommandUIExtension>
</CustomAction>

其他提示

我使用了一种略有不同的方法。我只需要使用一个定义来添加到现在和将来的所有不同列表类型中。

http://djeeg.blogspot.com/2011/01/ribbon-customaction-on-all-lists.html

许可以下: CC-BY-SA归因
scroll top