Come si fa a creare un'azione personalizzata nastro del tasto che apparirà su tutti i tipi di liste

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

  •  16-10-2019
  •  | 
  •  

Domanda

Voglio creare un pulsante della barra multifunzione che funzionerà con tutti i tipi di liste. Voglio dire, la stessa azione personalizzata si impegnano a contrastare elenchi, raccolte documenti, liste di annuncio, ecc ..

Anche. Dovrebbe funzionare indipendentemente dai tipi di contenuto contenute nell'elenco.

Quale dovrebbe essere la definizione dell'azione personalizzata per questo?

È stato utile?

Soluzione

Basta agganciarlo alla 0x01 tipo di contenuto.

Un esempio della sintassi utilizzata nella nostra suite Audit SharePoint è la seguente:

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

Altri suggerimenti

ho usato un metodo leggermente diverso. Ho solo dovuto usare una definizione per il pulsante da aggiungere a tutti i diversi tipi di liste, ora e in futuro.

http://djeeg.blogspot.com/ 2011/01 / nastro CustomAction-on-all-lists.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top