SharePoint Designer created display forms do not display attachments when present.

Article ID: 2590041 - View products that this article applies to.
Expand all | Collapse all

SYMPTOMS

When a custom display form is generated by SharePoint Designer the attachment will not be exposed if one is present. Please refer to the following link for additional information in regards to custom list forms:

http://office.microsoft.com/en-us/sharepoint-designer-help/create-a-custom-list-form-using-sharepoint-designer-HA010378258.aspx

The out of the box ListFormWebPart does not exhibit this behavior.

CAUSE

The markup required to make this work is missing from the client.

RESOLUTION

To workaround this issue users can create a code snippet and insert the markup as needed via the code view.

Alternatively, users can just paste the markup that is use to create code snippets into the custom list form.

The following markup can be used to create the code snippet:

<tr>
 <td nowrap="true" valign="top" class="ms-formlabel" width="20%">
  <SharePoint:FieldLabel ControlMode="Display" FieldName="Attachments" runat="server"/>
 </td>
 <td valign="top" class="ms-formbody" width="80%">
  <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="Display" FieldName="Attachments" __designer:bind=""/>
 </td>
</tr>
To create a code snippet in SharePoint Designer 2010 do the following:

1. Click the File menu inside of SPD 2010.
2. Then click Options and under the general tab pick Page Editor Options.
3. Switch to the Code Snippets tab.
4. Click the Add button and give it a name like attachmentFix.
5. Provide a description to help given context to the code snippet.
6. Paste the following markup to automate the task of adding in the attachment functionality for display forms.
<tr>
 <td nowrap="true" valign="top" class="ms-formlabel" width="20%">
  <SharePoint:FieldLabel ControlMode="Display" FieldName="Attachments" runat="server"/>
 </td>
 <td valign="top" class="ms-formbody" width="80%">
  <SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="Display" FieldName="Attachments" __designer:bind=""/>
 </td>
</tr>
7. Click OK and then OK.
8. Now, when working with a custom list form and it requires the above markup perform the following in code view: Control + Enter.
9. This will bring up the built in code snippets and the one created. Pick attachmentFix and all the markup will be inserted.

This can be further automated through a group policy or other delivery mechanisms. For example, Windows 7 uses the following path to store custom code snippets:

C:\Users\UserName\AppData\Roaming\Microsoft\SharePoint Designer\Snippets

The following document explains the code snippet's internals:

http://msdn.microsoft.com/en-us/library/aa218645(v=office.11).aspx#odc_fpcustomizingsnippets_tocreateacodesnippet

The file SnippetsCustom.xml contains the following after performing the steps above:

<?xml version="1.0"?>
<!-- Code Snippet Configuration File -->
<snippets><snippet keyword="attachmentFix">
  <description>Custom display form attachment fix.</description>
  <text>&lt;tr&gt;
 &lt;td nowrap="true" valign="top" class="ms-formlabel" width="20%"&gt;
  &lt;SharePoint:FieldLabel ControlMode="Display" FieldName="Attachments" runat="server"/&gt;
 &lt;/td&gt;
 &lt;td valign="top" class="ms-formbody" width="80%"&gt;
  &lt;SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="Display" FieldName="Attachments" __designer:bind=""/&gt;
 &lt;/td&gt;
&lt;/tr&gt;</text>
 </snippet>
</snippets>



MORE INFORMATION

The Edit and New Forms don't have this issue depending on your patch level and product version.

1. After installing Service Pack 2 for SharePoint Designer 2007 and WSS 3.0 the attachment functionality will work correctly for Edit and New Forms going forward. Old forms will need to be supplemented with the new functionality.

2. SharePoint Designer 2010 and SharePoint Foundation work correctly with Edit and New forms out of the box.

3. SharePoint Designer 2007 and SharePoint Designer 2010 experience the issue with Display forms.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2590041 - Last Review: August 17, 2011 - Revision: 4.0
APPLIES TO
  • Microsoft Office SharePoint Designer 2007
  • Microsoft SharePoint Designer 2010
Keywords: 
KB2590041

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com