Show file attachments for SharePoint list items in a Data View Web Part (DVWP)

I needed to display all the attachments of a SharePoint list item in a DVWP. Thanks to Marc’s article for helping me out.

I added the code that Marc provided between a <td> tag. Magically, it worked!


<xsl:text>Attachments: </xsl:text>
<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”/>