4

How to add a column in a sharepoint list which will contain all attachments of the corresponding item with hyperlink(clickable).

  • You can't add an attachment "column" in SharePoint. You can attach documents to list items though. That function is already built in. – jpollar Jan 11 '17 at 15:20
  • I want to show attachment URLs in Javascript Dynamic table along with all other columns. – Manish Samal Jan 11 '17 at 15:30
  • Then you need to create a custom application page that will do that. – jpollar Jan 11 '17 at 16:19
5

You will need to enable attachments for your list, to do this go to advanced settings and select enable attachments:

enter image description here

You will then find the option to add an attachment directly to your list item through the form, seen below:

enter image description here

To show in list view:

Add a new column title "Attachments" in Designer.

Within the TD tag of the new column replace with this code:

 <td id="ItemAttchment" class="ms-vb">
      <xsl:element name="SharePoint:AttachmentsField">
      <xsl:attribute name="runat">server</xsl:attribute>
                <xsl:attribute name="FieldName">Attachments</xsl:attribute>
      <xsl:attribute name="ControlMode">Display</xsl:attribute>
      <xsl:attribute name="Visible">true</xsl:attribute>
      <xsl:attribute name="ItemId">
          <xsl:value-of select="@ID"/>
      </xsl:attribute>
      </xsl:element>

Reference

0

You can attach multiple files using that icon on the ribbon. But you have to enable attachments on the list's advanced settings

0

Well, Yes you can add an attachment column to your list. You just need to append a custom button html to the NewForm.aspx.
Actually,the form columns are displayed in a tabular format in the newform(To confirm inspect the html of NewForm).
Just write a simple jquery code to append the 'button td' into your form and on its click call the UploadAttachment() function[Sharepoint predefined function].

This is the code i used to append the attach button td in my form -

$(document).ready(function(){
    $('[id*="_TextField"]').closest('table').append("<tr><td>Add Attachment</td><td><input type='button' onclick=' javascript:UploadAttachment()' value='Add File'/></td></tr>");

});

 You can add this code to your form by adding a content editor web part.

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.