Have you ever tried to deploy a custom survey as a list definition in SharePoint 2007?

This is what I’ve done:

  1. Created a survey with my 5 questions in the interface. And then used SPM2007 (see codeplex) to export the list details such as fields, views etc
  2. Created a list template in Visual Studio (Changed all the bits that I need to change to turn it into a survey

a. Added my question as fields in the schema.xml

b. Gave my list template a unique Type

c. Set Base Type to 4 in my list definition

d. Created a feature to activate the Survey.

My list definition:

<?xmlversion=1.0encoding=utf-8 ?>

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>

<ListTemplate Name=MySurveyTemplate     






DisplayName=My Survey

Description=A survey list template





I got the survey to appear in my site. So far so good.

I tried to respond to my question however the form only contains a Cancel and Save button.

As I’ve got branching on this Survey there should also be a Next button. Where has the Next button gone to?

I tried a couple of different options but I couldn’t get this to work.

Then I decompiled the sharepoint dll looking for the ListFormWebPart code and I noticed that to identify if we’re talking about a Survey or not sometimes the following code is used: (template != SPListTemplateType.Survey)

and sometimes

(this.list.BaseType == SPBaseType.Survey)

The second option isn’t really a problem as BaseType is set to 4 and this is the same as the out of the box Survey. However the first line could be the cause of my problem as my Type is set to 20002.

As the type has to be unique … I wonder if it’s not possible to deploy a survey this way?

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

4 thoughts on “SharePoint 2007 – Deploying a custom survey as a list definition feature”
    1. It isn’t possible with the out of the box create a list template options. Or at least I haven’t found a good way of doing this. You could create a survey list and then programmatically update the list. But that becomes less manageable.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.