Forum Discussion
yunus96
Nov 08, 2022Copper Contributor
how to create one-click direct download links on Image column in Sharepoint List
Hi there, I've a sharepoint list by name "Employee Directory", this list have a column by name "Photo" where we store employee photo. I want this photo to be downloadable by just one click. Is ther...
Nov 08, 2022
Hi!
you can use view formatting json for this:
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting
Example code for creating this button and download image:
{
"$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]"
}
}
]
}
yunus96
Nov 08, 2022Copper Contributor
thanks NicolasKheirallah, for taking time to help me.
But it's downloading some other file with extension ".000". for examples its downloading file "94.000".
How do I set it to the image column in my list?