Issues caused by removing web parts from standard Survey pages

One of my current customers is leveraging the Survey capabilities that come out-of-the-box (OOB) with SharePoint 2007.  We came across some issues the other day where the following symptoms were present.

  • Results could not be exported to Excel or only the “Author” and “Created” fields were exported to Excel
  • Attempting to show the “Full Toolbar” caused the page to error and redirect to the web part maintenance page
  • The three OOB views (“Overview” – overview.aspx, “All Responses” – allitems.aspx, “Graphical Summary” – summary.aspx) were not available when editing the web part properties
  • The “Show a graphical summary…” and “Show all responses” links were not present on the “Overview” page
  • If you open “overview.aspx” in SharePoint Designer, you will notice that the “DetailLink” element has a value of “/” instead of the relative path to the page
  • Questions added to the survey after the issue occurs will show up in an Excel export
  • When using the “Content and Structure” page to view the survey list, a “value outside the expected range” message will be displayed instead of the survey responses.  The SharePoint logs will contain an error that says “View ‘Overview’ does not exist”.
  • If you go to the “Survey Settings” page after removing the OOB web part, you will notice that the Web Address for the survey is now set to the root site URL

Despite the symptoms above, users were still able to respond to the survey.  The “Number of Responses” and other data on the “Overview” page were accurate.  So what happened and how did we fix it?  Thought you’d never ask.

Background

A Survey list is a special type of list.  You cannot create additional views (or modify the OOB views), but you can drop the Survey’s list view web part on any page just like you can do for any other list.  The three OOB pages each utilize the list view web part.  Users can edit (Site Actions –> Edit Page) the OOB pages, since these pages are just web part pages.  The “View History” option is not available for the OOB pages, so there is no way to go back to the original version of the page.

The Problem

The problem was caused when the OOB web part was removed from the “Overview” page.  For some reason, this throws the survey into an unstable state.  Dropping the list view web part back onto the OOB page does not correct the issue.  In fact, if you attempt to set the “re-dropped” web part’s toolbar to “Full Toolbar”, the page will throw an error.

NOTE: The “Guid Picker” tool is extremely helpful in this process, since it provides quick access to the GUIDs for each list, view, etc.

The Solution

Fixing this issue requires SharePoint Designer. 

  1. Create a “test” survey in the same site as the broken survey (because you will need to copy/paste some of the XML elements)
  2. Open the site with Designer and navigate to the survey (from left nav, select “Lists” and then select your survey)
  3. Check out and edit the “overview.aspx” page
  4. Open the “overview.aspx” page for the “test” survey (created above) so that you have a basis for what the values should be
  5. Change the value of the “DetailLink” element in the broken survey’s page from “/” to the relative URL for your survey’s “Overview” page
  6. Copy the entire “ListViewXML” element from the “test” survey and use it to replace the “ListViewXML” element in the broken survey
  7. Get the GUID for the “Overview” view of the broken survey (using the Guid Picker) and replace the GUID in the “ListViewXML” element of the broken survey
  8. Update the “Url” attribute of the “ListViewXML” element so that it points to the relative URL for the Overview page.  Note: This should always point to the “Overview” page.

image

At this point, all issues with the “Overview” page should be resolved.  If the user edited the “AllItems” and “Summary” pages and removed the OOB web parts from these pages, too, steps 2-8 will need to be repeated for each page (with each reference to the “Overview” page in the instructions being changed to whatever page you are editing).  However, the “Export to Spreadsheet” function will only export the “Author” and “Created” fields to Excel.  This is the tedious part (more questions = more tedious).  To fix the export issue, perform the following step(s).

  1. The “ListViewXML” element contains a “ViewFields” element that identifies the name of each question (field), as shown below.  For each field, add “&lt;FieldRef Name=”<your field”/&gt;” to the value, replacing the <your field> token with the name of your question/field.

image

Note: Although tedious, the quickest way that I found to get the question/field name is to open the question from the “Survey Settings” page and copy the value from the “Field” parameter in the URL. You will need to replace all “%5F” tokens with “_”. I created the new string in Notepad and pasted the finished value in Designer, since it was easier to edit in Notepad.

The first time the page was saved in Designer, a warning message was displayed saying that you were creating a customized page, which is something that you generally want to avoid.  After you have saved all of the changes above and checked the page in, you can use the “Reset to Site Definition” to return the page to the un-customized state and it will not overwrite the edits made above.  Resetting to the site definition will create a copy of your customized page (as a backup).  If you do not delete the copy, you will end up with duplicate entries in the “View” dropdown (two “Overview” entries, two “All Responses”, etc.).

Hopefully this will save you the time and effort that it took me to figure it out.