Download button in View formatting JSON

Occasional Contributor

Hi,

 

Im create a view in a document library to give an overview of the files with a description.

 

ViewFormat.png

On that view I would like a download button, to download the files directly.

On known file formats link JPG i just opens the file and on unknown formats link EPS it dowloads the file.

The code looks like this:

 

 

 

 "elmType": "button",
                  "style": {
                    "background-color": "#6eb556",
                    "color": "white",
                    "font-weight": "bold",
                    "font-size": "1rem",
                    "float": "right",
                    "margin-right": "150px"
                  },
                  "customRowAction": {
                    "action": "Download"
                  },
                  "txtContent": "Download",
                  "attributes": {
                    "class": "sp-row-button"

 

 

 

Is there a way to force it always to download the file? 

1 Reply

@Jesper Würtz Have you found a solution to this? I also need a button in a sharepoint document library that allows the user to download documents.

 

According to this article it seems that only 

  • defaultClick
  • share
  • delete
  • editProps
  • executeFlow

are valid option for "customRowAction.