SharePoint

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


Have you ever tried to deploy a custom survey as a list definiton 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 Definiton

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

<Elements xmlns=http://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?

Advertisements

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.

      Like

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s