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..
When you create an Add-in for SharePoint 2013 project in Visual Studio 2012, references to the .NET Framework assemblies, Microsoft.SharePoint.Client.Runtime.dll andMicrosoft.SharePoint.Client.dll, are automatically added to the project. For other kinds of projects, such as .NET Framework applications or console applications, you should add these references. The files are located on any SharePoint 2013 server at %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\ISAPI.
All of these examples assume that the code is in a code-behind file for an Microsoft ASP.NET webpage. You must add the following using statement to the code file.