Spoodoo.com

Open list item attachments with a click on the paperclip

This is a mobile optimized version of this page, view original page.

UPDATE February 13th, 2014: An even newer version is now available which you can check out here.

Another requirement of one of my users is to open file attachments directly by clicking on the paperclip icon without the detour of opening the item first. Alexander Bautz from spjsblog.com wrote the perfect script for this purpose which you can find here on his blog post. Thanks for that!

However, the last update was from mid 2012 and therefore the latest version is not compatible with SharePoint 2013. I made some minor adjustments to the code to restore the compatibility and I added a fade-in and fade-out animation, as well.

And here is how it will look like:

All you have to do is uploading this script to the Style Library (or any other document libary, SVN or the Hive )  and putting the following snippet into a CEWP or Script Editor Web Part on the page where you want to to have this functionality.


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="..location of the script here../ListAttachments.js"></script>
<script type="text/javascript">
var argObj = {hideIdColumn:true,
              clickToOpen:false,
              clickMouseover:'Click to open',
              oneClickOpenIfSingle:true};
</script>

Please note: To make this script work, your list view has to have the ID column as well as the attachment column visible.

The four options you can see in the snippet above are as follows:

  1. hideIdColumn: Defines whether the ID column will be hidden or not
  2. clickToOpen: Defines whether you have to click in the paperclip in order to see the list of attached files or not
  3. clickMouseOver: Defines the text in the tooltip when you hover your mouse over the paperclip
  4. oneClickOpenIfSingle: Defines if an attachment is directly opened or not if it is the only attachment of the list item

Have fun with the script!


UPDATE February 12th, 2014: There was a small error in the  script. Please download the script again if you have downloaded it before February the 12th, 2014. Alternatively you can fix the script yourself:

Download: Click Here