Thursday, February 4, 2010

SharePoint Custom List Form with 'Attach File' link working

The 'Attach File' link does not work in custom List Forms. This is a known issue as evidenced in the discussion threads below: (this thread also contains some alternate approaches to resolving this issue)

Listed below are the 2 MS Support articles related to this issue:

In my case, I had to sort of combine the resolution steps provided in the 2 MS Support articles above. You will see this in my "12 Steps" below.

First and foremost, you need to ensure that you have this configuration in your environment:

1. SP2 (with latest cumulative updates) for SharePoint
2. SP1 for SharePoint Designer (SPD) 2007
3. Install KB960311

I got the steps listed below to work only in the above configuration.

If you have SP2 for SharePoint Designer installed, then you need to remove SPD 2007, re-install it. When you re-install SPD 2007, SP1 will be included in it. You don't have to install SP1 for SPD separately. Then you need to install KB960311. Thanks to my astute Manager, Yoshio Kurtz, for this tip regarding SPD configuration. I would not have been able to resolve this issue without Yoshio's help.

If you have SPD 2007 + SP2, and then try to install KB960311, you will get the following error:

The expected version of the product was not found on the system.

KB960311 does NOT work with SPD that has SP2. It works with SPD that has SP1.

"12 Steps "

1. Created a new List in SharePoint.

2. Ensured that the ‘Attach File’ link works.

3. Ensured that I can view the ‘correct’ Web Part properties window for the default ListFormWebPart in SPD.

4. Added a ‘Person or Group’ column to the List in SharePoint.

5. Ensured that the ‘Attach File’ link works.

6. Created the custom New Form (this gets rendered in a DataFormWebPart) in SPD. I chose to create it outside the WebPartZone.

7. Closed and hid the default ListFormWebPart in SPD. Saved changes. Configured the List to use the custom New Form using the ‘Supporting Files’ tab in SPD.

8. Ensured that the ‘Attach File’ link works.

9. Edited the custom New Form in SharePoint using the ‘&ToolPaneView=2’ URL option, and added a Content Editor Web Part (CEWP).

10. Moved the CEWP to the bottom of the page using SPD. The CEWP was also placed outside the WebPartZone.

a. So the order in which the Web Parts are "situated" in the page are:

i. FIRST, Default ListFormWebPart inside the WebPartZone

ii. SECOND, Custom DataFormWebPart outside the WebPartZone

iii. LAST, CEWP outside the WebPartZone

11. Using SharePoint, added JavaScript code, in the CEWP, to hide/show the People Picker control based on the value selected in a drop down list. Check out my post for the JavaScript code.

12. Tested the Form. Custom Fields work, Hide/Show conditions work, and above all ‘Attach File’ works. I also tested it with multiple files and it worked too.

No comments: