I intend to create list using code. So I used an empty SharePoint project and in that I used the ApplicationPage.aspx. In that I wrote the following code:
using(SPSite siteColl=new SPSite(@"http://diplsp:1090/"))
{
SPWeb webSite = siteColl.OpenWeb();
webSite.Lists.Add("Leave Form1", "", webSite.ListTemplates["Calendar"]);
SPList leaveList = webSite.Lists["Leave Form"];
leaveList.OnQuickLaunch = true;
leaveList.Fields.Add("Start Date", SPFieldType.DateTime, true);
leaveList.Update();
}
So according to the above code I should see the list created on my quick launch, but its not happening. However if I use the console application or list feature the above code works perfectly.
Please suggest.