1

I have a list with the following columns:

  • Job Description (Single Line of Text)

  • Attachments

And also I got a Column named "internLink" which contains the exact name of the document which is attached.

Now I wanted to ask, if it is possible to just get the document name of the attachment with JSON and insert it into a JSON href?

3
  • I assume the "internalLink" column stores the document name. And you goal is to use the name to create a link which users can click and redirects to the document, correct? Where do you want to display the link? Are you using SharePoint Online modern list with json formatting? – Jerry_MSFT Dec 4 '20 at 7:07
  • Yes exactly We are using Sahrepoint Online modern yes – Oliver Dec 4 '20 at 7:36
  • You want to get the document name from "internLink" field or SharePoint default Attachments field? – Ganesh Sanap Dec 4 '20 at 8:48
1

Unfortunately, the attachments field is not directly accessible in List Formatting. However, if you have the filename stored in the internLink column then you should be able to build a format to link to the attachment. Assuming you apply this to the internLink column below (if another column the internLink field still needs to be in the view and you'll switch out @currentField with [$internLink]):

{
    "elmType": "a",
    "txtContent": "@currentField",
    "attributes": {
        "href": "=@currentWeb + '/Lists/YourListNameHere/Attachments/' + [$ID] + '/' + @currentField + '?web=1'"
    }
}

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.