Thursday, September 15, 2011

How to allow users accessing attachments directly in a Discussion Board list without clicking view properties?


It is very difficult to see if an item has an attachment in a SharePoint list since you are forced to see the properties and scroll all the way to the bottom to get to the attachment. 

One particular example is when using the Discussion Board list to capture meeting minutes. Here is the screen for one discussion published to harryDiscussionBoard list based on “Discussion Board” list template. The attachments will not be displayed on this page.



You will have to click the “View Properties” to the discussion listform.aspx page and scroll all the way down to see the attachment links.




 
The users would like to see the attachment links directly in the Flat or Threaded view of the Team Discussion list. The attached picture shows a mock up of the Flat view with the attachments directly accessible in the view. 

To make this enhancement more usable by all users it would be nice to have the ability to add the "links to the attachments" of any item to any SharePoint view regardless of the list type.
How to allow users accessing attachments directly in a Discussion Board list without clicking view properties? We are in the process to design and implement this to make it generic that can be applied to other lists.




One of the suggestions from Entan Ming is to customize the Flat and Threaded view through SPD. Here is the summary of the approach.


1.       Open the Flat.aspx page in SharePoint Designer .
 
2.       Add an empty data view web part on the page .
 
3.       Select the data source as Discussion Board .
 
4.       Insert the ‘Attachments’ field to show on the web part .
 
5.       Add these code under this line <xsl:template name=”dvt_1.rowview”>:
 
    <td class="ms-vb">
 
           <xsl:element name="SharePoint:AttachmentsField">
 
           <xsl:attribute name="runat">server</xsl:attribute>
 
           <xsl:attribute name="ListId">{9629F1F6-B06E-4983-9E50-F00126BB0940}</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>
 
Change the ListId to your discussion board ID .Then you can save and preview in browser .
 

We are planning to develop a feature to automate enable the feature so the webpart similar to what Entan Ming suggested can be added through feature. The other approach using JQuery or list web services query we used before can also be evaluated.

Anyone have any other good suggestions?






2 comments:

  1. Thank you for this - I've used it to display the attachments to a discussion board, but it displays all the attachments, not just the ones for the discussion item I'm looking at. Any ideas?

    ReplyDelete