Wie erstellen Sie eine benutzerdefinierte Aktion der Taste, die auf allen Arten von Listen angezeigt wird

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

  •  16-10-2019
  •  | 
  •  

Frage

Ich möchte eine Bandknopf erstellen, die mit allen Arten von Listen funktioniert. Ich meine, dieselbe benutzerdefinierte Aktion sollte gegen Listen, Dokumentbibliotheken, Ankündigungslisten usw. funktionieren.

Ebenfalls. Es sollte unabhängig von den in der Liste enthaltenen Inhaltstypen funktionieren.

Was sollte die benutzerdefinierte Aktionsdefinition dafür sein?

War es hilfreich?

Lösung

Haken Sie es einfach an den 0x01 -Inhaltstyp.

Ein Beispiel für die in unserer SharePoint Audit Suite verwendete Syntax ist wie folgt:

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

Andere Tipps

Ich habe eine etwas andere Methode verwendet. Ich musste nur eine Definition verwenden, damit die Schaltfläche jetzt und in Zukunft zu allen verschiedenen Listentypen hinzugefügt wurde.

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top