i'm creating a Provider-Hosted add-in for Sharepoint online and i want to select multiple files and send their ids with or their urls as query parameters in the CommandAction of a custom ribbon placed in the command bar.

Inside the i can use the EnabledScript to show the button when there are selected files but i can't find a way to run a script or append the files ids to the url inside CommandAction.

For what i read here https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/sharepoint-add-ins-ux-design-guidelines?redirectedfrom=MSDN#figure-4-a-custom-action-in-the-contextual-menu CustomAction can't have javascript code and actually returns an error.

But in multiple places in the documentation, for example here https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site#using-the-coreribboncommands-app, they show javascript code inside the CommandAction. Is it out-dated?

Also when selecting multiples files most of the tokes listed here https://docs.microsoft.com/en-us/sharepoint/dev/schema/commanduihandler-element, appear as empty.

This person wanted to do the same as me but was never answered SharePoint Online Ribbon Custom Action : Pass multiple itemId in CommandAction's Url.

So is it possible to select multiple files and redirect to my server with the ids of them?

1 Answer 1


I think you posted a similar post on StackOverflow here. Please check my answer and let me know was it of any help đź‘Ť

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.