Saturday, November 28, 2009

How SharePoint Works with Survey

Recently we are having requirement that how to access Survey List Programmatically in SharePoint.

First we think that there should be some object like SPSurvey just same as Document library list SPDocumentLibrary, but sadly that object is not there.

But rather than thinking long we can access Survey same as simple list as SPList only :)

Simple…

But what we found is somewhat new to everyone, at least for us.

SharePoint Survey is storing data in reverse manner as what we think.

Each question that we are entering for survey is created as column and all the answer stored as row value.

Let’s show you Example

Question of survey is : Do you like this?

Answer choice (in radio button or dropdown) are : Yes, No, Don’t know

So you will get SPList.Items.GetDatatable(); like below

So it’s a little confusing right.

But anyway that will help you whether you should take any task to work on Survey programmatically or not?



Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com