0

Hello Geeks,

Here a new question in my mind that how to create a list in SP using CSOM.

Briefly:

I want to create a list with custom fields and also want to insert items at once at the time of list creation.

I am doing something like this…

string siteUrl = “http://address/sites/siteName/”;
ClientContext clientContext = new ClientContext(siteUrl);
Web web = clientContext.Web;
try
{
web.Lists.Add(new ListCreationInformation
{
Title = “Sessions”,
Description = “SPSNL 14 Sessions”,
CustomSchemaXml = “<Field DisplayName=’CustomField’ Type=’Text’ /><Field DisplayName=’CustomField2′ Type=’Text’ />”,
Url = “Lists/Sessions”,
TemplateType = (int)ListTemplateType.GenericList,
TemplateFeatureId = new Guid(“00BFEA71-DE22-43B2-A848-C05709900100”),

});

clientContext.ExecuteQuery();
}
catch(Exception ex)
{
throw ex;

}

I am not able to find out exact result as required 

Only list is being created when programs run..

(Visited 97 times, 1 visits today)
Add a Comment