Assume we have the action bar in SharePoint for document libraries. Assuming I want to create a simple link like https://foobar.com/some-great-action?id=$ListItemID, how I can do that the easiest way?

enter image description here

Preferred with a way where scripting works and no Visual Studio and C# is required.

Important: I just need that for files; not for folders. Although the screenshot might imply something different. 😉

  • Do you want this for folders or just documents? Jul 2 at 13:16
  • Just documents, thanks for asking.
    – GreNodge
    Jul 2 at 13:17

Using ListView Command Set extension:

If you want the new command in top bar you have to develop a SPFx ListView Command Set extension.

You can find more information at: Build your first ListView Command Set extension

Using Column formatting:

If there is no requirement to have the link/button in top bar only, you can create a link using SharePoint JSON column formatting capabilities. This is an easiest way without SPFx development.

Use below JSON in Format this column option:

  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "Click here to open link",
  "attributes": {
    "href": {
      "operator": "+",
      "operands": [

You can use this JSON on any supported column in document library, few suggestions:

  1. Use default Title column if you are not using it for storing specific document titles.
  2. Create a calculated column with formula =[Title] & use above JSON on this new column
  3. Create a Single line of text column --> Add it to library view --> Hide it from library forms/properties form (optional).


enter image description here

Documentation: Use column formatting to customize SharePoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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