I created an empty sharepoint project. Then I added a new application page and in the page_load
method of the page I wrote this code:
protected void Page_Load(object sender, EventArgs e)
{
SPSite sitecollection = SPContext.Current.Site;
SPWeb web = /*sitecollection.OpenWeb()*/ SPContext.Current.Web;
web.AllowUnsafeUpdates = true;
SPListCollection lists = web.Lists;
lists.Add("My new List", "A new list created using code", web.ListTemplates["Calendar"]);
SPList newOne = web.Lists["My new List"];
newOne.OnQuickLaunch = true;
newOne.Fields.Add("Demofield", SPFieldType.Text, false);
newOne.Update();
}
And if I am right a new list will be created on the quick launch bar, but its not happening so. Did I miss something????