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.


Daniel

Open list item attachments with a click on the paperclip


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:

  • Normal version: Replace line 24 with ‘var argPlaceholder;
  • Minimized Version: Insert a space in line 23 at column 5263

Download: Click Here


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

23 comments

  1. Hi. I am trying to use this script on our SharePoint 2013 site, and I’m not having much luck so far. I have uploaded the listattachment files to my site asset library, along with jquery.

    I created a new page, and put the list webapp at the top of the page. I then put your snippet into a script editor under the list with attachments, with both script sources pointed to the correct location. The behavior on the paperclip doesn’t change, it remains “unclickable”.

    I have the attachment column and the ID column both visible in the current view as well.

    We are using SharePoint 2013 Online (hosted by Microsoft) if that makes a difference.

    Any suggestions?

    1. Hi Michael,

      thanks for your comment. You are absolutely right, for some reason one space-character was missing in line 24 of the script and the execution stopped there.

      Please change ‘varargPlaceholder;’ into ‘var argPlaceholder;’ or download the script again. It should definitely work then.

  2. I am curious why I have no thumbnail icon for pdf file type. Other icons seem to work correctly. The pdf file type does have an icon present in document libraries.

    1. figured it out, thanks. I needed to change the path to src='/_layouts/15/images/ic" + item.ext + ".png'
      works fine now.

  3. Hi there,

    I am very glad to have come across this. However I have some questions:

    1) I am having difficulty getting the click to open or the hover to work when I access a list, unless I first go to quick view and then back to normal view. I can't just go to a list and get the functionality.

    2) I would really like for this to work when I am using list grouping, as I have a list with many many attachments in it grouped based upon region. Is there a way to make this work?

    Thanks!

  4. This piece of code provides exactly the functionality I needed. Thanks for putting it together and sharing. However, if the filename of the attachment includes special characters like apostrophes (single quotes), ampersands and periods, the resulting hyperlinks are broken. Does the construction of the URL need to pass through a URL encoding?

    1. Solved my own problem. Looks like ampersands and trailing periods (which creates a situation like this filename..pdf) are not supported by SharePoint at all. The apostrophes, though, are supported by SharePoint but the ListAttachment script here was allowing the apostrophe to function as a string termination quote- which broke the hyperlink. In a nutshell, you just need to escape the apostrophe so that it is treated as part of the URL and not the end of the URL.

      Line 257 looks like this now: wrapBuffer.push("<a href='" + item.fullPath + "' ");
      Fixed if you change it to: wrapBuffer.push("<a href='" + item.fullPath.replace(/\'/g,"&apos;") + "' ");

      There might be a more similar (and perhaps more elegant) way to do this with URL/URI encoding, but the code above works. Would love it if Daniel would include one of these in the next version…

  5. Hi, I see where David figured out his PDF icon issue, but I can't seem to figure out how to add an icon type definition/file for ICS files (using a calendar icon). Is this still on line 256? Where is /_layouts/images/ic relative to my site? Is this the same as the images folder viewable within SharePoint Designer? If it makes a difference, this is on SharePoint Online.

    Thanks!

  6. Hi. I am trying to use this solution in a combination with another. On a webpart page I used the Tabbed web part solution for SP 2013 from Mark Rackley. Link: http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=42. The combination works only partially. In a tab with multiple attachment, the attachment window just pops up for a very short time and then vanishes. In other tabs with only a few attachment it works perfectly. Also the attachment pop up doesn't work if the list has a grouped view. Can somebody please help me with that.

    Thanks and kind regards

  7. Thanks for this. It works great for me on our SharePoint 2013 site. We use it from the quickedit view.

    I wonder if it'd be possible to add an additional attachment somehow. Eg a link in the balloon brings up the add attachment dialog.

    Thanks

  8. Hello

    My company is using this solution and we are very pleased with it. We showed it to a client but they can't open it. Mixed content option on the Internet Explorer is activated but the preview window for the attachment is not showing.
    We tried to open the SharePoint list on Firefox or Chrome but there isn't an option for activating the mixed content permanently or activating it for specific sites.
    Did someone had similar experience.

  9. Hi,
    I am currently experiencing an issue with this in SharePoint 2013.
    Everything works correctly as it should until I scroll down on the page. My list is currently limited to 30 items per page. When I scroll down , the bubble still pops up but it is not in the correct location, and then it quickly disappears. If I scroll back up on the page all works correctly.

    Any ideas?

  10. how do you implement this for all list and libraries by editing the master page? i tried and does not seem to work for some reason, my other scripts works fine.

  11. Alternative Link l69
    L69 is one of the official sites that provide the most recent alternative link trusted online betting sites.
    L69 provides more than one alternative link from each and every betting site, and all of us here have become one of
    the most comprehensive alternative link suppliers and the L69 site contains a
    responsive display that will makes it easy that you should access our site from the display of your device or laptop.
    And what you should know is that we here just have 1 official link,
    l69. me and if there usually are other websites
    that offer information or call our own website is not the official site.

    Ball betting and casino gambling are types of games that are very popular with the people of
    Indonesia. Why l69? Because we've been here for more than five a number of have become the trust associated with the individuals of Dalam negri as a location to enjoy soccer gambling as well as on-line casino gambling.
    Itself in addition has obtained a license coming from the Asian and Western european governments last season to turn out
    to be an online gambling betting provider site in Asia and Europe.

    By offering lots of different types of gambling bets that may be played
    upon one ID, it makes typically the members feel happy actively playing
    in your bookie.
    Benefits of Alternative Links l69
    Nevertheless sadly lately there usually are many members who
    experience problems and problems when entering into their Bola tangkas game since the Sbobet site is often blocked and many aged sites have been clogged by the Indonesian authorities and never a few are also impacted in what
    will be called the Newsletter Task. The Indonesian government these days is struggling to eliminate
    links or paths to gain access to sites that smell associated with pornography,
    gambling and there are a number of other content that will is deemed inappropriate.

  12. Depoxito is the best online gambling site in Indonesia, in the same way
    as Depoxito you will environment the sensation of playing new and advanced online gambling.
    We always innovate fittingly that all our members can tone a sensation taking into account playing at
    a genuine casino. Depoxito have the funds for
    you the best breathing casino feelings you can acquire
    as soon as all the pretty and sexy dealers, or grand vip saloon private room
    for our VIP aficionado where you can bill one upon one with our special Dealer all just for yourself.

    Luxurious site and VIP class further for you,
    a forward looking and easy-to-use site, friendly and always friendly Customer help to support you.
    Depoxito is the right substitute for those of you who want to action online gambling
    without worrying that your winnings will not
    be paid, Depoxito guarantees that every
    bet you place and win is legitimate and will be paid without incurring any unwritten deductions.

    Depoxito as a site that is a partner of international big bookmakers unconditionally will not disappoint you as a faithful enthusiast of the
    Depoxito site and will continue to endeavor other updates and amend our security system
    therefore that it can prevent our loyal members from the threat of personal
    data leakage, scam or fraud.
    Depoxito is as well as a trusted online gambling dealer that
    provides the most unconditional gambling games in Indonesia, such as sportsbook, slot games, flesh and blood casino, lottery and online poker that you can behave later just 1
    Account.
    In adjunct to the total VIP facilitate game upon our site,
    we will pamper you our loyal members because you
    don't compulsion a lot of IDs to play in alternative gambling games.
    As a gambling site accredited by PAGCOR (Philippines Amusement and Gaming
    Corporation) Depoxito is plus one of the number one gambling sites in Indonesia and has a
    fine reputation from all online gambling players in Indonesia.

    As we have said, we have a customer assistance that is
    always on standby to bolster all your needs while playing upon our site, including for withdrawals and deposits that and no-one else allow less
    than 3 minutes, in view of that we can be the best for
    devotee support furthermore our customer facilitate will standby 24 hour a daylight
    and 7 days a week to foster our believer and VIPs.
    And the most special from our site compared to supplementary
    sites is the added that we have enough money to our loyal members who continue to deed on our
    site will acquire the best promos and bonuses that we will have enough money you, we always follow the spread around and trends that are viral now so the promos that we create
    are of course no less than any site. For VIP members we always give special promos that are not written as
    a result that our members continue to undertaking
    on our site depoxito.

  13. Watch the Best Movie associated with All Time
    What movie do you want to be able to watch today? Sniper movies may
    be required upon your list. This is the most exciting
    shooting battle, where every sniper actions is always interesting to watch.

  14. The state and Best Soccer Wagering Agent, One of typically
    the best soccer gambling sites operating in the Hard anodized cookware region, including Indonesia, is Sbobet.
    Known as the site that won a couple of awards as the best owner, Sbobet continues to be serving the customers for 7
    years and counting and carries on to survive as the
    oldest and largest internet gambling internet site in Asia.

  15. Panduanjudi Login

    Panduanjudi is a trusted and attributed poker site from PKV games server.

    We allow 9 types of sophisticated games that can be played using just one ID.

    The games we give add up poker, domino99, bandarq,
    aduq, sakong, bandar66 and also capsa susun. In addition to having a large
    variety of games, www.Panduanjudi.com as well as has several
    handsome promos that can be enjoyed directly after bodily registered as a
    member. subsequent to perfect weekly cashback promos that are calculated from
    the sum turnover, both winning and losing. besides Panduanjudi truly appreciate if there are members who invite connections or associates
    to put it on on our site by giving a referral supplementary of
    10% to 20% of the number of turnover downline invited to play.

    To be the best poker site, Panduanjudi is always exasperating to append our services to be
    adept to have enough money the best experience in playing poker at our place.
    One of the ways is the Gambling lead provides a means of payment that reaches all
    elements of Indonesian society. By committed like leading banks and obliging Simpati and XL bank account deposits.
    As skillfully as which players can make deposits using E-wallets such as GoPay, OVO and
    Funds. additional than those mentioned above, of course there are still advantages in Panduanjudi to
    torment yourself to become the best poker sites such as:

  16. Are you a lover of online slot wagering games? This game has been around for 100s of
    years but is still one of the favorite games in Usernesia even in luxury
    gambling places like Vegas or Macau, slots are always neatly aligned waiting for fans to pull levers and win jackpots that reach billions of rupiah..

    But , did you know if this game was in the beginning considered
    a flop game? Indeed, at the beginning of this game created by their creator named Charles August Fey in 1894 in the United States, this machine was
    intended being an computerized poker game machine that could be moved using coins.

    After trying to build his idea into reality, Fey finally gave up and considered his discovery
    a failure. But who would have thought that all this machine turned out to be one of the most widely used online games
    in the world. Not only in slot gambling online games provided by wagering houses
    but also the concept utilised by various games as a "bonus game".

    This is where the game involving the RNG or Randomly Number Generator was initiated, where the machine will assign random values ​​that will determine what you will get each and every round of
    the overall game. Not only slots but additionally online games like virtual sporting activities or bonus games like
    gacha also use this kind of concept.

  17. Usernesia Alternative Link
    By means of online gambling games, you will get income
    because well as enjoyment without having to be able to leave your comfort
    at home. One of the sites that provides the best online gambling games
    inside Indonesia is Usernesia. Through this web site, you can discover a number of00 interesting and popular gambling games
    for example soccer betting, online slots, on-line casino, lottery, on-line poker, arcade video
    games and so on.

    Unlike other gambling sites that you could find on the web, Usernesia gives you various conveniences in online
    gambling online games. As a fresh member, you will end up given a lot
    of convenience in signing up, getting lucrative bonuses, including an alternate Usernesia link that will you can access
    without having to experience difficulties being blocked or even the need to use a new VPN.

    Quite Useful Account Registration Via Usernesia
    For anyone that can't wait to join and play in the best
    and many trusted gambling sport in Usernesia, the method is pretty practical.
    All you want to do will be visit the official site at www.userbolavip.net or the
    Usernesia option link which you can rapidly access from your previously mentioned.

    We will always update if typically the link from the button above cannot be accessed by our members and possible members.

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.