2

I created a custom list where I upload attachments to. I also added the new column "attachments" with a staple icon.
But is there also a way to display the name of my attachment with a direct download link?
I only found tutorials for SharePoint (Designer) 2010, but I'm using SharePoint 2013 on Office 365.
A document library is not what I want to use.

  • we can download files from attachment fields then upload them with event receiver on another document library then create a link with query string to filtered view on doclib. (A document library is not what I want to use) simple and easy way is doc libs – saber tabatabaee yazdi Dec 11 '16 at 5:03
1

By default, there is an Attachments column in the SharePoint List, some people want to display attachments name and click name can open the documents in List View. In this article, we would show you the method with REST API, JSLink and jQuery.

Hope this article helps you: Show Attachments in SharePoint 2013 Custom List View

EDIT:

I just made everyhing as posted on that article on my test sharepoint online environment, and it's working. I have downloaded the "Download the compressed, production jQuery 1.11.3" and uploaded that file to SiteAssets library. After I copied the code from that article and paste it in notepad and saved as showAttachments.js and also uploaded to SiteAssets library.

enter image description here

Then go to your list with attachments and press "Edit page", select list webpart and modify it by adding this text to "js link" field on Miscellaneous section: ~site/SiteAssets/jquery-1.11.3.min.js|~site/SiteAssets/showAttachments.js

And the result:

enter image description here

EDIT 2:

But this has a bug: if I press on the link of this list, it shows only attachment icons, but if I press f5 it starts working again and showing the links.

This post could give a right direction on how to impove a script: The correct way to execute JavaScript functions in SharePoint 2013 MDS enabled sites

Edit 3: Use this on MDS enabled sites:

ExecuteOrDelayUntilScriptLoaded(function () {...
  • Download the jQuery API etc. Is this all possible with SharePoint on Office365? I don't have a local copy of it on my machine, so I don't know, whether I'm able to edit it this way. – user87238960 Jun 16 '15 at 10:09
  • you need to download JQuery file and put it on SiteAssets library. Then copy code from that article and save it also to that library. So it should be possible for SP Online. – martusha Jun 16 '15 at 10:16
  • Ok, I did everything in this tutorial and that is the error I get: ReferenceError: $ is not definedReferenceError: $ is not definedReferenceError: $ is not definedReferenceError: $ is not defined ReferenceError: $ is not definedReferenceError: $ is not definedReferenceError: $ is not definedReferenceError: $ is not definedTypeError: Cannot read property '_events' of null – user87238960 Jun 17 '15 at 11:13
  • 1
    Please check everything once again. I just made everyhing as posted on that article on my test sharepoint online environment, and it's working. I have downloaded the "Download the compressed, production jQuery 1.11.3" from jquery.com/download and uploaded that file to SiteAssets library. After I copied the code and paste it in notepad and saved as showAttachments.js and also uploaded to SiteAssets library. Then go to your list with attachments and press "Edit page", select list webpart and modify it by adding ~site/SiteAssets/jquery-1.11.3.min.js|~site/SiteAssets/showAttachments.js – martusha Jun 17 '15 at 11:55
  • Ok, it was the wrong jQuery. I updated the jQuery file and it worked for a moment, but after a refresh (F5) it stopped working again, so I see the paper clip again. – user87238960 Jun 17 '15 at 12:15
0

I got round this issue by using Infopath Designer to inject the filename part of the URL into a "simple line of text" field, and then a SharePoint designer workflow to build the complete URL.

The steps were as follows.

  1. create a "single line of text" field in your list. I called mine "AttachmentURL"

Add a single line of text field

  1. Load infopath designer. and load your SharePoint list

  2. Right click on the "single line of text" field "AttachmentURL" and select "Text box properties"

Select text box properties

  1. In the "Default Value" section next to "Value", click the "Fx" button

Fx

  1. In the "Formula" dialog box, select the "Insert Field or Group" button

Insert field or group

  1. In "Advanced view", expand the "Attachments" folder, and select the ":attachmentURL" icon and click "OK" all the way back to your form

Select field or group

  1. After making any other alterations in your form, publish the form to the SharePoint list

Publish

This gave me the attachment filename. I then used SharePoint Designer to build the rest of the URL :

  1. Open SharePoint Designer and go to your list workflow

  2. You will now be able to build the Attachment's URL by creating a hyperlink that follows this construction :

    https://site/Forms/Lists/LISTNAME/Attachments/ID/AttachmentURL

Create hyperlink in designer

I had no issue creating the attachment URL in a designer workflow with this method. You can then push the full URL to another field if you like, or email it with the workflow.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.