07.10.2011 A new version is published – you find it here.
23.09.2010 Moved the code to a server for direct download to make it easier for the users. You find the link below. The current stable version is 1.5.
13.09.2010 Fixed bug when ID column was not placed to the far right.
07.09.2010 Fixed bug when list view was not the topmost webpart.
30.08.2010 Added “one click open” if only one attachment is found.
I got this request from Chris:
…the challenge I’m currently trying to solve is to get the attachments paperclip in a listview clickable. Using a doclib and linking against the file is not an option since we are talking about a lot of files with the same name which should be stored with the list entry (one file per entry).
There’s a solution from Paul Grenier at EUSP, but that doesn’t work for large collections, so it’s not usable.
I thought of setting up the path ‘manually’, and displaying this entry, since I noticed that the attachment path is always like URL/site/lists/listname/attachments/list_item_id/filename. Though I might be able to come up with all the details up to the ID I have no idea on how to get the filename automatically.
Can you think of any other way to make the paperclip clickable to open the attachment?
Here we go:
It is tested in IE8, Chrome 5.0 and Firefox 3.6.8 in WSS3.0. It works in both standard list views, and grouped views.
It has briefly been tested in SP2010, but is only partially compatible (minor issue with the click on the paperclip selecting the row, and it only works in non-grouped views).
The only requirement for this solution to work is the ID column being in the view – it can be hidden by setting the variable hideIdColumn = true (default).
The CEWP code
Place the CEWP below the list view!
Download the file “previewAttachmentsOnClick.js” from this location
When new versions are released, they will be placed in a folder with the version number as label. Be sure to download the latest version.
If you are using a browser other than IE, right click the file and select “Save link as” or “Save linked content as…”.
As if anything is unclear.