List View: Expand Attachments

Grebe, Patrick 21 Reputation points
2021-07-30T12:28:07.76+00:00

Hello,

you can attach documents to SharePoint list items. However if you add the “Attachments” column to your list views, you get a column that only shows a paperclip icon (see below) if there are any attachments. Clicking that paperclip also won’t open any attachment or the list item to view them. It’s strictly an image.

I would like to replacet hat paperclip on each row with the actual name(s) of your attachment(s) linked to the actual attachment(s).
In SharePoint 2013 I used a script for this. Are there any alternatives for SharePoint-Online?

Users have got used to it, and it saves clicks.

Thanks in advance! :)

Microsoft 365 and Office SharePoint Server For business
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. Allen Xu_MSFT 13,861 Reputation points
    2021-08-02T02:54:15.513+00:00

    Hi @Grebe, Patrick ,

    As per my knowledge, there is no OOB way to replace the paperclip icons with the names of the attachments in the attachment field. This is by design for distinguishing the function of list and library in SharePoint. It is not recommended to store or manage documents in a list. Anyway, if you still want to achieve your needs, the following way may be an alternative.

    • Create a Single line of text in your list. In this example, I created a column named "interLink"
    • fill the above created field with the name of the attachment.
      119596-image.png
    • Format the column with JSON code. {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
      "elmType": "a",
      "txtContent": "@currentField",
      "attributes": {
      "href": "=@currentWeb + '/Lists/<yourlistname>/Attachments/' + [$ID] + '/' + @currentField + '?web=1'"
      }
      }

    Test result in my list. The attachment will be opend once you click the attachment name in the new created column.
    119694-image.png

    Also, If you only want to modify the Attachements column, you have to inject cutomized CSS/JS code to SharePoint modern page using SPFx Extensions.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. Reuben Mandlenkosi Ndlovu 1 Reputation point
    2023-02-01T16:59:41.8366667+00:00

    Hi Patrick, How did you manage to display the attachments in SharePoint Onprem list without showing the paperclip?


  2. Reuben Mandlenkosi Ndlovu 1 Reputation point
    2023-02-01T17:02:51.3733333+00:00

    Hi Patrick, how did you manage to display the attachments of a SharePoint 2013 list item using a list view?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.