あらゆる種類のリストに表示されるリボンボタンカスタムアクションをどのように作成しますか

sharepoint.stackexchange https://sharepoint.stackexchange.com/questions/6158

  •  16-10-2019
  •  | 
  •  

質問

あらゆる種類のリストで動作するリボンボタンを作成したいと思います。つまり、同じカスタムアクションがリスト、ドキュメントライブラリ、アナウンスリストなどに対して動作するはずです。

また。リストに含まれるコンテンツタイプに関係なく機能するはずです。

これのカスタムアクション定義は何ですか?

役に立ちましたか?

解決

0x01コンテンツタイプにフックするだけです。

SharePoint監査スイートで使用されている構文の例は次のとおりです。

<!-- 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>

他のヒント

わずかに異なる方法を使用しました。ボタンに1つの定義を使用して、現在および将来、すべての異なるリストタイプに追加する必要がありました。

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

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top