Forum Discussion
Jesper Würtz
Oct 03, 2019Copper Contributor
Download button in View formatting JSON
Hi, Im create a view in a document library to give an overview of the files with a description. On that view I would like a download button, to download the files directly. On known fi...
nina_torjesen
Jan 03, 2022Copper Contributor
I have a script for a download button that works:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "button",
"style": {
"flex-direction": "column",
"width": "80px",
"border": "none",
"border-radius": "3px",
"margin": "10px 0"
},
"attributes": {
"class": "ms-bgColor-themePrimary"
},
"children": [
{
"elmType": "a",
"txtContent": "Download",
"style": {
"color": "white",
"text-decoration": "none",
"padding": "12px 0px 12px 0px"
},
"attributes": {
"target": "_blank",
"href": "= @currentWeb + '/_layouts/15/download.aspx?UniqueId=' + [$UniqueId]"
}
}
]
}
How to:
- Create a single line column named f.ex. "Download"
- Add the json script in format column
Screenshot: