I am trying to add List to a site via console App. Here is what I have so far.
namespace spConsole
{
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://spdev.com/SitePages/Home.aspx"))
{
SPWebCollection webcoll = site.AllWebs;
SPWeb web = webcoll["SubSite1"];
SPList newList = web.Lists.Add("New List", "Description", SPListTemplateType.GenericList);
}
}
}
}
I am getting the following error:
Cannot implicitly convert type ‘System.Guid’ to ‘Microsoft.SharePoint.SPList’
Can some one please tell me what I am doing wrong?
You have not created the instance of SPSite
Please follow this link to create new list programatically
http://sarangasl.blogspot.com/2009/11/create-sharepoint-list-programmatically.html
OR
http://www.mindfiresolutions.com/Create-List-Programmatically-in-SharePoint-274.php