I would like to add a custom action in the group "Connect and export" of the list ribbon when on the AllItems.aspx page. No server code is allowed. This should be done by using JavaScript. The picture shows where the new custom button should be added.

enter image description here

By now, I succeed to add the button to another group. Unfortunetely it is added every time I refresh the page. You can find the source here.

$(document).ready(function (){

function AddExportXlsCustomButton(){
    var context = new SP.ClientContext.get_current();
    var list = context.get_web().get_lists().getByTitle("Dossiers CRME");
    var customAction = list.get_userCustomActions().add();
    var uiExtension = '<CommandUIExtension xmlns="http://schemas.microsoft.com/sharepoint/">' +
                    '<CommandUIDefinitions>' +
                        '<CommandUIDefinition Location="Ribbon.List.CustomizeList.Controls._children">'+
                            '<Button Id="Ribbon.Documents.New.RibbonCustomExcelExport" '+
                                    'Command="Notify" '+
                                    'Sequence="0" '+
                                    'Image16by16="/_layouts/1036/images/formatmap16x16.png" '+
                                    'Image32by32="/_layouts/1036/images/formatmap32x32.png" '+
                                    'Description="Exporte les éléments sélectionnés vers un fichier Excel." '+
                                    'LabelText="Exporter vers Excel (Personnalisé)" '+
                                    'TemplateAlias="o1"/>' +
                        '<CommandUIHandler Command="Notify" '+
                            'CommandAction="javascript: ;" />'+
    context.executeQueryAsync(Function.createDelegate(this, success),Function.createDelegate(this, error));

function success(){ console.log("success"); }

function error(){ alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace()); }

Thank you very much.


1 Answer 1


The line

'<CommandUIDefinition Location="Ribbon.List.CustomizeList.Controls._children">'+

Should be

'<CommandUIDefinition Location="Ribbon.List.Actions.Controls._children">'+

Those links helps me out:

http://www.sharepointnadeem.com/2013/09/add-ribbon-button-in-connect-export.html https://msdn.microsoft.com/en-us/library/ee537543(v=office.14).aspx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.