I'm currently looking for a new job, preferably in the Asia-Pacific region but I would consider other regions as well. If you are hiring or have any leads, I would appreciate if you would drop me a message via the contact form, e-mail (daniel(at)spoodoo.com), Twitter, or LinkedIn.


(Updated) Open list item attachments by clicking the paperclip – Version 2

Update 28th of July, 2014: Script updated to version 2.3 (see the changelog)

End of January I adapted the script to open list item attachments with a simple click on the paperclip symbol, which Alexander Bautz from spjsblog.com wrote, to SharePoint 2013.

In the last couple of days I have made some further improvements to this script which I want to share with you.

Due to the fact that SharePoint now stores the item ID within the the TR-tag’s ‘iid attribute, it is not longer required to put the ID column into the view. Therefore, it also not necessary anymore to use the ‘hideIdColumnattribute. Just decide in the view configuration whether you want to see this column or not.

Additionally I changed the presentation of the attachments to a nice speech bubble styled overlay which looks much better than the simple box from the earlier version (imho).

In order to style the speech bubble to your needs, I introduced three new  properties which are ‘colorFont’, ‘colorGradientStart’ and’colorGradientEnd’. It is not necessary to give the bubble a gradient. If you want it to have a uniform color just give ‘colorGradientStart and ‘colorGradienEnd the same value.

  1. colorFont: the font color inside the bubble, can be a HEX (e.g. ‘#000000’), RGB (e.g. ‘rgb(0,0,0)’) or Word value (e.g. ‘black’)
  2. colorGradientStart: start color of the gradient (top), must be an RGB value (e.g. ‘rgb(231, 14, 30)’)
  3. colorGradientEnd: end color of the gradient (bottom), must be an RGB value (e.g. ‘rgb(187, 6, 20)’)

You can read about the other properties here.

The complete code snippet you have to put on the page may now look like that:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script><script type="text/javascript" src="/Path to the Script/ListAttachments_v2.3.js"></script>
<script type="text/javascript">
    var argObj = {clickToOpen:false,
                  clickMouseover:'Click to open',
                  colorGradientStart: 'rgb(231, 14, 30)',
                  colorGradientEnd: 'rgb(187, 6, 20)',
                  colorFont: 'white'

In the example above, the bubble containing the links to the attachments will open when you hover your mouse over the paperclip symbol and will close when your mouse leaves the bubble. The color of the bubble is a gradient of two variations of red and the font color is white.

And here is how it looks like in action:

Script in action (animated GIF)

Enjoy the easy way to view and open list item attachments!

Update February 14th, 2014:

I made further improvements and the script will also show attachments in the Quick Edit mode, now:

Version 2.2 in Quick Edit mode

Update July 28th, 2014:

Script now works with the Newsletter view style, too.
The ID column must be included in the view, otherwise it won’t work.
To hide the ID column use the argument ‘hideIdColumn’ with the value of ‘true’.


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script><script type="text/javascript" src="/Path to the Script/ListAttachments_v2.3.js"></script>
<script type="text/javascript">
    var argObj = {clickToOpen:false,
                  clickMouseover:'Click to open',
                  colorGradientStart: 'rgb(231, 14, 30)',
                  colorGradientEnd: 'rgb(187, 6, 20)',
                  colorFont: 'white',
                  hideIdColumn: true

Click here to download the script

Tweet about this on TwitterShare on RedditShare on FacebookShare on Google+Share on LinkedInShare on StumbleUponShare on TumblrPin on PinterestDigg thisPrint this pageEmail this to someone


  1. Hi. I am trying this work of yours in my List but sad to say it is not working. Can you guide me please? I am kinda lost.

    What i did was make a standard view and add the title, id and attachment column. Then edit the view and add Script Editor and put it at the end of the page. But it did not work. Please help.

    1. It’s really hard to tell why it is not working without further information.

      However, I updated the script and maybe this version (v2.2) works better for you. According to what you did it should definitely work. I just tried it in my uncustomized SharePoint environment and it worked right from the start.

      If v2.2 is not working as well, please have a look into the error console in your browser (F12) and tell me the error messages (if any).

          1. Sure,
            add the following code after line 212:

            $(“div[id^=customAttDiv] a”).bind(“contextmenu”,function(){
            return false;

        1. Hi there,

          How did you get this working for you as it doesn't work for me at all?
          I put the code in a CEWP but nothing happens??? No error anywhere…
          I'm using ListAttachments_2.4.js

  2. Hi Daniel – this is not working for me and it may be because I am using SharePoint Online (Office365) or because I am trying to get it to work in a View as opposed to in a web part.

    The error that I get on the main page is “Web Part Error: Unknown server tag. Correlation ID: ce4d869c-93b8-b056-feb5-92fbae95bdf5.”

    I also checked the F12 and the Console only had the following Informational entry “JavaScript Console is attached and accepting commands.”

    Any ideas on what I can do from here?
    Thanks, Mark

    1. Hi Mark,

      sorry for the late reply. I don’t completely understand what you did to get this result.

      Were you able to follow all the steps that I mention in my post?

  3. Hi Daniel… Cool widget, but we’re seeing a problem. In SharePoint 2013, when the code snippet is installed on the listview page, the tabs at the top of the page for items and list disappear. The only tab that remains is the Browse tab. We have to a use the HTTP:\\MYSHAREPOINT?ToolPaneView=2&pagemode=edit trick to get back into editing the page. Any ideas why?

    1. Hi Ken,

      I think what you are talking about is by design. As soon as you have more then the original web part on a list view page the item and list tab will disappear. In order to see it you have to click into the list first, otherwise SharePoint does not know which web parts properties you want to see/edit.

      If i’m right with this assumption then I see no way to change this behavior at the moment. But i’ll have a look into it.

      1. Duh. I didn’t think to try clicking on the web part – will try that tomorrow… If that works it’s fine the way it is…

  4. Thanks this works great!
    the display works great with MS projects but it displays a box with a X when it comes to a pdf attachment. any ideas on a way to add a pdf icon?
    many thanks again..

    1. Hi Bill,

      Please follow these instructions to get the PDF icon working:

      Please remember to adjust the paths mentioned in that post. For SharePoint 2013 replace ../12/.. with ../15/..

      1. Thanks for sharing your 2013 update, awesome.
        phase2.com is down – not sure if forever or just for now. Any other links for enabling the PDF icon?

        Thanks so much,


        1. Hi Joe,

          Just drop any icon you want into 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\'

          Rename the icon to 'icpdf.gif' and that's it.

  5. This is awesome, thanks! Unfortunately it seems not to work when I change the layout of the list view to "newsletter".. which was the look I was looking for (doing a news listing where users want to attach one or more files to a post).

    Any suggestions?

    1. Hi EHG,

      thanks for the comment, glad you like it.

      i'll have a look into it and update the script once its done.


      1. Daniel,

        thanks for the reply. Would be really greateful if that functionality is added. Hopefully some more people would like that addition too!

        1. Hi EHG,

          good news, the script in version 2.3 works with the Newsletter style as well. Only requirement is that the ID column is included into the view. I have reintroduced the hideIdColumn-argument which will hide the ID column if you don't want to see it.

          Please give it a try!


  6. Have just applied this solution to a couple of lists belonging to a customer, fantastically simple yet effective, cap doffed for the hard work and thanks for sharing.

  7. Daniel,

    Thanks for this, after long searches I finally found you and got excited about rolling it out.

    Followed your instructions, but nothing happens and I have this error on my page:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
    Timestamp: Fri, 5 Sep 2014 16:41:32 UTC

    Message: Expected '}'
    Line: 1367
    Char: 19
    Code: 0
    URI: xxxxxx.com/Home.aspx

    Message: 'g_spPreFetchKeys' is undefined
    Line: 66
    Char: 2
    Code: 0
    URI: xxxxxx.com/SiteAssets/ListAttachments_2.3.js

    But no one else has any issues so think I might be doing something wrong. I only have a bit of HTML, no java experince at all.

    1. Hi Scott,

      the first error is caused by the properties object, there was a comma missing after "colorFont: 'white'". I corrected the article.

      I'm not yet sure what is why the second error is popping up for you. I just tried the script again with the default masterpage in an unmodified environment where all the necessary code is put into a Script Editor Web Part and it's working fine for me.

      Please try it again with the missing comma added, I hope its working for you then.


  8. Daniel,

    Thanks, that got rid of the first error.

    I have a list with ID, Attchment and Title column.

    I paste the code into a CEWP (edit HTML option) and place that under the list.

    Nothing changes when I do this, and I get an error alert.

    When I run debug on the page it comes up with the same error:

    Message: 'g_spPreFetchKeys' is undefined
    Line: 66
    Char: 2

    I had a look at the code and it looks to be in the jquery part, so I even copied and pasted that locally rather than use ajax.google.etc but still same error.

    Do you think it could be a versioning issue? Maybe my java or something is out of date?

  9. aaand I just realised I was wasting your time trying to put this onto a SP2010 site.

    Sorry about that, I grabbed the SP2010 version you based this off and it works fine.

    Now just wating for the admins to update.

  10. Hi Daniel,

    I have followed instructions above. I am using SP 2013, ListAttachments_2.3.js and I have locally saved the jsquiery 1.9.1 in Site Assets.

    I get the following errors from debugger. The paperclip does appear but nothing populates.

    Error in parsing value for 'background'. Declaration dropped. AllItems.aspx:1
    Unknown property '-moz-border-radius'. Declaration dropped. AllItems.aspx:1
    Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. AllItems.aspx:1
    Unknown property '-moz-opacity'. Declaration dropped.

    I have tried v2.2. But I just get a spinning wheel and nothing populates.

    Any idea?


    1. After more debugging I find the script skips over after not finding any class ids

      line 206
      table.find("tbody>tr:has(td[class^=ms-vb])").each(function () {

      1. Hi Reuben,

        Sounds tricky.

        1. which browser and browser-version are you using?
        2. Please tell me how your argObj looks like
        3. If possible send me the HTML source of one of your SharePoint-pages (that contains a list and the script) via the contact form


  11. Hi Daniel,

    thanks a lot for your work, it's a really useful script, and adds functionality to Sharepoint that should come by default.
    I have it working, but I ran into two issues:

    1) It doesn't work when the Attachments column is after a multiple-lines-text-column in the Newsletter view style, only when the Attachments column is before. See these screenshots:

    2) The hideIdColumn parameter works for the header of the table, but not for the body, which leads to the situation that the column headings are not in sync with the table content anymore. See these screenshots:

    I'd be happy to assist with testing if you want to fix these! :)


  12. And one more thing: I'd love to see a version where the paperclip actually gets replaced with (or appended by) the list of file names. That would be extremely useful for my use case (creating a PDF from a newsletter style "full text" view of a list).

  13. Hi Daniel,

    So first I tried this in a SEWP by itself and altered the script to reference the copy I downloaded and stored in a document library. But that didn't work.

    Then I tried to reference the local copy with a CEWP. That didn't work.

    Then I had the SEWP with the script in it referencing the local copy AND the CEWP referencing the local copy. This worked. It allowed me to hover over the paperclip and click on the attachments. However, the CEWP displays all the code that it seems to be executing. When I go to edit the CEWP and change the layout to hidden, it no longer executes.

    I must be doing something wrong. Can you please give advice? I'm using SP 2013, Windows 7, and latest IE.


  14. I am using O365, SharePoint 2013, and I have managed to get this working on a ListView WebPart via SharePoint Designer. This is an awesome addition to the functionality of my list! Thanks for the share!!!

    I have a bit of a problem, though. Maybe I'm not seeing this correctly, but I am not able to set more than 1 expected file extension for the image file that the script looks to retrieve. For instance, I needed to change Line 256 in the script to pull a .png for the PDF icon in src='/_layouts/15/images/ic" + item.ext + ".png'. I am getting the PDF icon now (and some others), but there are other icon file types that are not .png.

    Can you create a sort-of wildcard extension for the retrieved icon file? The icon would then display no matter the extention and if not it would be the fault of the icon and not the script. Or is there another way to do this? Thanks again…

  15. Hi, this works great except… I need it to work on lists that are grouped. What would I need to change to make this work on one level grouped lists?

      1. I figured it out…

        On line 254… I changed src to "_layouts/15/images/ic" and the extension from .gif to .png so it uses the SharePoint 2013 default icons. No icons are missed now.

        Thanks again!

  16. Using v2.4 of the script… I created a page with a web part containing a list with the attachments field visible and an script editor web part under it with the code snippet referencing local copies of the ListAttachments scripts. It does not work though. No popup, no errors, nothing. Please advise as I am really looking forward to this script. Thanks!

    1. Hi,

      Do you finally get this working for you? I run into the same issue.
      No error but nothing happens…
      I'm also using v2.4.

  17. Great script.
    I made these changes
    1) Correct location for icon filesin sharepoint 2013
    wrapBuffer.push("<img id='customAtt_" + i + "_icon' style='vertical-align:middle; height: 16px; width: 16px' src='/_layouts/15/images/ic" + item.ext + ".png' border='0'>&nbsp;");
    2) If file name contains ' we have to handle it
    item.fullPath = item.fullPath.replace("'","%27")

  18. This is by far one of the best looking and easy to install Attachment Link in a List solutions I have found. One thing however, I installed the 2.4 version in my styles library, and it works great in a regular list view, however it seems to break (the link pops up and disappears right away) in a Standard View with Group enabled. Other than that, it's awesome, thank you for your wonderful work!

  19. Appreciated your efforts

    However I had one glitch, when I was deploying the same code as a delegate control. As I required this functionality to all the lists (even if they are adding new lists), thus I injected script into masterpage with the help of delegate control (of course added as web level feature).

    Problem: $("div#contentBox") was empty because this line of code is called before it is load contentBox element (by using delegate control)
    $("div#contentBox").prepend("<div class='outerbubble' style='display: none' id='customAttPreviewWrapper'><div class='bubble' onmouseout='customMouseOutHideMenu(event, 1)'></div></div>");

    Solution: Moved above mentioned code inside of ready function

    Anyway this change may not be required for CEWP based solution.

  20. Thanks for this!
    Now, how to make this work with asynchronously updated lists?
    The point is that with asynchronous updates only the list data is updated/reloaded, without reloading the entire page/view… i.e. the script works only after the initial page load until the list content is updated in the background, then the balloons stop appearing (for obvious reasons).

    Any idea?

    1. I've had similar issues with JS in other instances and it always ended up being related to the minimal download strategy. Check out this post on the topic: http://blogs.msdn.com/b/sridhara/archive/2013/02/08/register-csr-override-on-mds-enabled-sharepoint-2013-site.aspx

      1. Nope, it's not the case, MDS is not active on the site in question.
        But, after reading the post I think that CSR is the way to go – 'hooking' the script to the "Body" field could do the trick… (sorry if I'm using incorrect terminology, I'm not a Sharepoint guy actually, just experimenting a bit)

    2. We just ran into pretty much the same issue (specifically that after a search or 2, the attachment icons no longer had pop-ups/links) and were able to work around it by doing this:

      1. Within the block of JS that starts with "thisWPContainer.each", change this:

      if(argObj.clickToOpen) {
      thisRow.find(">td:eq(" + attcolIndex + ")").find('img').attr('title', argObj.clickMouseover).css('cursor', 'pointer').click(function () {
      showAtt(this, argObj);
      } else {
      thisRow.find(">td:eq(" + attcolIndex + ")").find('img').attr('title', '').mouseover(function () {
      showAtt(this, argObj);

      to this:

      if(argObj.clickToOpen) {
      thisRow.find(">td:eq(" + attcolIndex + ")").find('img').attr('title', argObj.clickMouseover).css('cursor', 'pointer').addClass('attachment-link').click(function () {
      showAtt(this, argObj);
      } else {
      thisRow.find(">td:eq(" + attcolIndex + ")").find('img').attr('title', '').addClass('attachment-link').mouseover(function () {
      showAtt(this, argObj);

      The key thing to notice there is the addition of ".addClass('attachment-link')" in 2 places.

      2. Add this at the end of the jQuery(document).ready function:
      $(".ms-listviewtable").mouseenter(function() {
      if (! $(this).find("tbody > tr > td img[src*='attach']").first().hasClass("attachment-link")) {

  21. Hi,

    Thanks for the script!! it works like a charm however is there any know issues with IE 11? when I over the mouse on the paperclip, just nothing happen. I verified the settings of scripts execution and it seems all enabled. Any ideas?

  22. Hello

    I have a problem with the script. On IE 11 the attachment preview isn't showing even though a few weeks ago it worked perfectly. Now we have to use Chrome or Firefox and its not the same since we always have to manually activate mixed content on both browsers.
    Is there a way to make it work on Internet Explorer (version 11.0.9600.18015)?

    Thanks and best regards

  23. Hello,

    I'm just came across your post. We just got SP2013 and I'm trying to add the code to the List that I created but nothing comes up. Can you please advice?

  24. Hello,
    It worked for me in custom list..But I am using Visual Web part to search the Element from the same list and it will should show the attachment if attachment is available in search results….My question is that how to make this work for custom webpart solution..
    Thank you So much..

    1. Hi Dheeraj, can't help you on this one without knowing the HTML structure of the list-view in your webpart. Please contact me via daniel(at)spoodoo.com if you need help.

  25. Hi,

    I was able to successfully install this, but it appears that the hover/pop-up only works for people with admin access. I had a few "view-only" people try it on their laptops and it doesn't work for them. Nothing happens when they hover on the paperclip icon.

    Does one have to have admin access to see this feature?

    1. Hi Mae,
      No, admin permission level is not necessary. What's necessary though is the "Use Remote Interfaces"-permission. The 'View Only' permission level should actually have this permission activated by default. Please check and activate it if it's deactivated.

          1. I checked and the "Use Remote Interfaces" is checked in all of our permission levels. That didn't fix anything. It appears that it only works in my computer but it doesn't work in others. Would this have to do with browser setting?

            Just a little info that might help you troubleshoot….

            * I'm using a list – each list item has attachments
            * I created a site page where I've added the list to show inside a webpart. In this site page, I've pasted the script you've provided into the snippet.

            It works perfectly on my computer. I can go hover on the paperclip and the pop-up shows where I can click on the attachment to download. For some weird reason, I'm the only one who can see it. In both the page/library settings (where the webpart is) and list settings, I have two groups in the permission (Admins = full control, Visitors = Read Only). I think the permissions are correct, but I just don't know why it doesn't show in my co-workers computers.

  26. Hi,
    It is working fine in Chrome and Firefox. Any idea on make it work in IE 10 and above?

    FYI: I'm using ClicktoOpen as 'true'.

    In IE, It appears and disappears quickly (like a blink)..

    Waiting for reply..

      1. Hello Daniel,

        I am using 'ListAttachments_2.5.0BETA2.js' but still facing similar issue mentioned by Rajan.

        in IE it appears and disappears like a blink.

        Bhaskar Dhone

  27. Hi ,

    I am using this script 'ListAttachments_2.3 js' in Content editor web part,but i have error "g_spPreFetchKeys' is undefined" ,please help me how to fix this.

  28. Hello, I'm using your script, but it does not seem to work for me.

    I added a Script Editor web part. Then i pasted the code changing the url of the ListAttachments.js afterwards.

    The .js file is located on a folder inside the shared documents (just for testing).

  29. hi,
    I need your help, i followed all the steps but nothing happen, i dont have any error message but its not working.
    Please, can you help me?

  30. in sp 2013 list once hover on attachment only spinning wheel showing nothing else i don't know what is the problem i followed your instructions and i am using v2.2 can somebody help me please.

  31. Hi,

    I got this script to work at my previous job, but for some reason it isn't working on SharePoint site I'm creating at my current job. I've uploaded the ListAttachments_2.5.0BETA2.js to our Scripts library. Changed the URL/Path on the script. Added the code in Snippet inside a webpart … and nothing happens. No errors or anything — just nothing.

    What am I doing wrong?

  32. Script works, but is anyone seeing that the pop-up bubble only comes up if you hit just the right spot on the paperclip and disappears quickly?

  33. I am putting the two script calls in a script editor on the page with the list and making sure that the current list attachments is in the Scripts folder in Site Assets (and is referenced from there).

    The problem is that it does nothing. Is there something else I need to do to make this work?

  34. The bubble pops up and disappears again (blink/flash).
    HOWEVER!!! When I approach the paperclip from the bottom and keep moving my mouse at just the right speed so that the pointer is at the bubble's position when the bubble appears, it will stay, but only then.
    Using SP online/365.

  35. Sharepoint 2013,
    Put 2.5 script in siteassets -CEWP below view
    no error in F12 developmenttools
    added one alert line as first in script -> gets executed
    ID Column did not vanish – must it be the first column?

  36. Daniel,
    I'm using SP 2013 online /O365. I cant get the script to render in Chrome or Firefox. its ok in IE11 but in Chrome there's some added security when trying to edit the list web part as in error message below. is this the reason why?

    This page isn’t working

    Chrome detected unusual code on this page and blocked it to protect your personal information (for example, passwords, phone numbers, and credit cards).
    Try visiting the site's homepage.

  37. There have been some posts related to: "The bubble pops up and disappears again (blink/flash)." I see this behavior as well using IE. Daniel / anyone – has there been more discussion on this or a solution?

  38. version 2.5 is not working for me. 2.4 is working perfectly! Daniel, could you please check version 2.5 again ?

  39. for other guys that want to open attachment in browser with office online server or web app server, edit the source code and add the (+ "?web=1") to the end of *fullpath* attribute (line 143 in version 2.5.0)
    like this:
    fullPath: this.ServerRelativeUrl + "?web=1"

  40. Hi Daniel,

    Thanks for the codes – they work great!. Now I’d like to export the list metadata and attachment names to excel but the file name doesn’t export. Any ideas on how to make that happen? – Stacy

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.