Thursday, 28 June 2012

Display Item Attachments in SharePoint List View

It is very easy to display list item attachments in List View and also manipulate the display of attachment, like if attachment is image, we can display image not just a link.
1. Open List View in SharePoint Desinger
2. Add new column titled "Attachments".
3. Select TD tag of New column.
4. Replace selected code with below code.

XSLT 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>
</td>

 
 5. View with Attachments
 
 

3 comments:

  1. Thanks, worked perfect :) very happy with the result.

    ReplyDelete
  2. more then one attachment is not accessible?

    ReplyDelete
  3. how does this work in Sharepoint online??

    ReplyDelete