Monday, January 5, 2015

Create Survey list using client object Model

  

Survey list templates id is 102
public class Program
{
static void Main(string[] args)
{ ClientContext clientContext = new ClientContext("http://mysite/");
clientContext.AuthenticationMode = ClientAuthenticationMode.Default;
clientContext.Credentials = new System.Net.NetworkCredential
("administrator", "password", "raghupc");
Web oweb = clientContext.Web;
//Create the survey list ListCreationInformation lci = new ListCreationInformation();
lci.Description = "SurveyTest";
lci.Title = "SurveyTest";
//102 This is the list template id lci.TemplateType = 102;
List newLib = clientContext.Web.Lists.Add(lci);
clientContext.Load(newLib);
clientContext.ExecuteQuery();
}
}


2 comments: