0

How can I create a survey list through visual studio?

I am using sharepoint 2013 and visual studio 2013.

  • In the sense you are creating a SP2013 app? – Stephen Jan 24 '14 at 11:27
  • No. Empty sharepoint project. Am able to create custom lists, calender lists etc. – Praveen Prasannan Jan 24 '14 at 11:30
1

There is no "Survey" list template within Visual Studio 2012 (or 2013 to my knowledge) so you would need to create this yourself.

There is an in built survey App within the 2013. The site below gives you an idea of how to set that up.

How to quickly build a Survey using SharePoint 2013

| improve this answer | |
  • Thanks Stephan. I could do the same from sharepoint UI. But I need to do it using visual studio. For the ease of integration. Any way for getting it? – Praveen Prasannan Jan 24 '14 at 11:41
  • You could reverse engineer the WSP to give you the list details but you would still need to develop the rest of it. you would NOT be able to get the list template for VS. – Stephen Jan 24 '14 at 12:52
  • I am able to get and export the survey template as .stp file. Here I stuck. Can I copy entire stuff from manifest.xml to schema.xml? – Praveen Prasannan Jan 24 '14 at 17:17
0

You can create it from the SharePoint UI, export the site to WSP and then import it in Visual Studio, the below link explains how you can export the site to WSP and import it in VS.

http://ahmedmadany.wordpress.com/2012/12/30/importing-sharepoint-solution-package-wsp-into-visual-studio-2010/

| improve this answer | |
  • Sorry. But link is missing :) – Praveen Prasannan Jan 24 '14 at 11:59
  • Also can I export that survey only? – Praveen Prasannan Jan 24 '14 at 12:10
  • So sorry for late reply, i have added the link and yes you can import only the Survey List but you will have to export the whole site – Haitham Shaddad Jan 26 '14 at 13:10
0

You can create survey list using SharePoint client object model.this This code user can include anywhere just copy paste in your visual studio

ClientContext clientContext = new ClientContext("siteurl");
            clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
            clientContext.Credentials = new System.Net.NetworkCredential("administrator", "password", "raghupc");
             Web oweb = clientContext.Web;
            ListCreationInformation lci = new ListCreationInformation();
            lci.Description = "SurveyTest";
            lci.Title = "SurveyTest";
             lci.TemplateType = 102;
            List newLib = clientContext.Web.Lists.Add(lci);
             clientContext.Load(newLib);

             clientContext.ExecuteQuery();

Please find the attached link

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.