question

GrebePatrick-5160 avatar image
0 Votes"
GrebePatrick-5160 asked AllenXu-MSFT edited

List View: Expand Attachments

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! :)

office-sharepoint-onlineoffice-sharepoint-server-customization
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AllenXu-MSFT avatar image
0 Votes"
AllenXu-MSFT answered AllenXu-MSFT edited

Hi @GrebePatrick-5160 ,

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.


image.png (11.2 KiB)
image.png (4.9 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@GrebePatrick-5160 ,

Is there any update on this thread? I'm looking forward to your reply.

1 Vote 1 ·