SharePoint 2007 – Deploying a custom survey as a list definition feature

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.0"encoding="utf-8" ?>

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

      <ListTemplate Name="MySurveyTemplate"      
                    Type="20002"       
                    BaseType="4"
                    OnQuickLaunch="TRUE"
                    SecurityBits="11"
                    Sequence="410"
                    DisplayName="My Survey"
                    Description="A survey list template"
                    Hidden="FALSE"
                    Image="/_layouts/images/itgen.gif">
      </ListTemplate>
  </Elements>

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?


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Avatar of Pieter Veenstra

Is your business still running on paper trails, sprawling Excel files, or ageing Access databases? There's a better way — and I can show you exactly what it looks like. I'm the Technical Director of Vantage 365, a Microsoft solutions consultancy working with clients across the UK, the Netherlands, and worldwide. For over 30 years I've been turning messy, manual business processes into clean, automated systems that save time, reduce errors, and give teams the visibility they need to make better decisions. You can contact me using contact@sharepains.com

Related Posts

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.

Discover more from SharePains

Subscribe now to keep reading and get access to the full archive.

Continue reading