¿Cómo se crea una acción personalizada botón de la cinta que aparecerá en todos los tipos de listas

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

  •  16-10-2019
  •  | 
  •  

Pregunta

Quiero crear un botón de la cinta que va a trabajar con todo tipo de listas. Es decir, la misma acción personalizada debe trabajar con las listas, bibliotecas de documentos, listas de anuncios, etc ..

También. Se debe trabajar independientemente de los tipos de contenido que figura en la lista.

¿Cuál debe ser la definición de acción personalizada para esto?

¿Fue útil?

Solución

Just hook it to the 0x01 Content Type.

An example of the syntax used in our SharePoint Audit suite is as follows:

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

Otros consejos

I used a slightly different method. I only had to use one definition for the button to be added to all the different list types now and in the future.

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

Licenciado bajo: CC-BY-SA con atribución
scroll top